@tryfinch/finch-api-mcp 8.0.0 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/code-tool-types.d.mts +6 -9
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts +6 -9
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +12 -2
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +13 -3
- package/code-tool.mjs.map +1 -1
- package/package.json +2 -2
- package/server.js +1 -1
- package/server.mjs +1 -1
- package/src/code-tool-types.ts +6 -9
- package/src/code-tool.ts +15 -5
- package/src/server.ts +1 -1
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2026 Finch
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ For clients with a configuration JSON, it might look something like this:
|
|
|
45
45
|
If you use Cursor, you can install the MCP server by using the button below. You will need to set your environment variables
|
|
46
46
|
in Cursor's `mcp.json`, which can be found in Cursor Settings > Tools & MCP > New MCP Server.
|
|
47
47
|
|
|
48
|
-
[](https://cursor.com/en-US/install-mcp?name
|
|
48
|
+
[](https://cursor.com/en-US/install-mcp?name=%40tryfinch%2Ffinch-api-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkB0cnlmaW5jaC9maW5jaC1hcGktbWNwIl0sImVudiI6eyJGSU5DSF9BQ0NFU1NfVE9LRU4iOiJTZXQgeW91ciBGSU5DSF9BQ0NFU1NfVE9LRU4gaGVyZS4iLCJGSU5DSF9DTElFTlRfSUQiOiJTZXQgeW91ciBGSU5DSF9DTElFTlRfSUQgaGVyZS4iLCJGSU5DSF9DTElFTlRfU0VDUkVUIjoiU2V0IHlvdXIgRklOQ0hfQ0xJRU5UX1NFQ1JFVCBoZXJlLiIsIkZJTkNIX1dFQkhPT0tfU0VDUkVUIjoiU2V0IHlvdXIgRklOQ0hfV0VCSE9PS19TRUNSRVQgaGVyZS4ifX0)
|
|
49
49
|
|
|
50
50
|
### VS Code
|
|
51
51
|
|
|
@@ -60,7 +60,7 @@ If you use Claude Code, you can install the MCP server by running the command be
|
|
|
60
60
|
environment variables in Claude Code's `.claude.json`, which can be found in your home directory.
|
|
61
61
|
|
|
62
62
|
```
|
|
63
|
-
claude mcp add
|
|
63
|
+
claude mcp add tryfinch_finch_api_mcp_api --env FINCH_ACCESS_TOKEN="Your FINCH_ACCESS_TOKEN here." FINCH_CLIENT_ID="Your FINCH_CLIENT_ID here." FINCH_CLIENT_SECRET="Your FINCH_CLIENT_SECRET here." FINCH_WEBHOOK_SECRET="Your FINCH_WEBHOOK_SECRET here." -- npx -y @tryfinch/finch-api-mcp
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Code Mode
|
package/code-tool-types.d.mts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { ClientOptions } from '@tryfinch/finch-api';
|
|
2
2
|
export type WorkerInput = {
|
|
3
|
-
|
|
3
|
+
project_name: string;
|
|
4
4
|
code: string;
|
|
5
|
+
client_opts: ClientOptions;
|
|
5
6
|
};
|
|
6
|
-
export type
|
|
7
|
+
export type WorkerOutput = {
|
|
8
|
+
is_error: boolean;
|
|
7
9
|
result: unknown | null;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
export type WorkerError = {
|
|
12
|
-
message: string | undefined;
|
|
13
|
-
logLines: string[];
|
|
14
|
-
errLines: string[];
|
|
10
|
+
log_lines: string[];
|
|
11
|
+
err_lines: string[];
|
|
15
12
|
};
|
|
16
13
|
//# sourceMappingURL=code-tool-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,qBAAqB;AAEnD,MAAM,MAAM,WAAW,GAAG;IACxB,
|
|
1
|
+
{"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,qBAAqB;AAEnD,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
|
package/code-tool-types.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { ClientOptions } from '@tryfinch/finch-api';
|
|
2
2
|
export type WorkerInput = {
|
|
3
|
-
|
|
3
|
+
project_name: string;
|
|
4
4
|
code: string;
|
|
5
|
+
client_opts: ClientOptions;
|
|
5
6
|
};
|
|
6
|
-
export type
|
|
7
|
+
export type WorkerOutput = {
|
|
8
|
+
is_error: boolean;
|
|
7
9
|
result: unknown | null;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
export type WorkerError = {
|
|
12
|
-
message: string | undefined;
|
|
13
|
-
logLines: string[];
|
|
14
|
-
errLines: string[];
|
|
10
|
+
log_lines: string[];
|
|
11
|
+
err_lines: string[];
|
|
15
12
|
};
|
|
16
13
|
//# sourceMappingURL=code-tool-types.d.ts.map
|
package/code-tool-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,qBAAqB;AAEnD,MAAM,MAAM,WAAW,GAAG;IACxB,
|
|
1
|
+
{"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,qBAAqB;AAEnD,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
|
package/code-tool.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAgE;AAIhF;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CA2DlC"}
|
package/code-tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAgE;AAIhF;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CA2DlC"}
|
package/code-tool.js
CHANGED
|
@@ -41,14 +41,24 @@ function codeTool() {
|
|
|
41
41
|
},
|
|
42
42
|
body: JSON.stringify({
|
|
43
43
|
project_name: 'finch',
|
|
44
|
-
client_opts: { accessToken: (0, server_1.readEnv)('FINCH_ACCESS_TOKEN') },
|
|
45
44
|
code,
|
|
45
|
+
client_opts: { accessToken: (0, server_1.readEnv)('FINCH_ACCESS_TOKEN') },
|
|
46
46
|
}),
|
|
47
47
|
});
|
|
48
48
|
if (!res.ok) {
|
|
49
49
|
throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
const { is_error, result, log_lines, err_lines } = (await res.json());
|
|
52
|
+
const hasLogs = log_lines.length > 0 || err_lines.length > 0;
|
|
53
|
+
const output = {
|
|
54
|
+
result,
|
|
55
|
+
...(log_lines.length > 0 && { log_lines }),
|
|
56
|
+
...(err_lines.length > 0 && { err_lines }),
|
|
57
|
+
};
|
|
58
|
+
if (is_error) {
|
|
59
|
+
return (0, types_1.asErrorResult)(typeof result === 'string' && !hasLogs ? result : JSON.stringify(output, null, 2));
|
|
60
|
+
}
|
|
61
|
+
return (0, types_1.asTextContentResult)(output);
|
|
52
62
|
};
|
|
53
63
|
return { metadata, tool, handler };
|
|
54
64
|
}
|
package/code-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAetF,
|
|
1
|
+
{"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAetF,4BA2DC;AAxED,sCAAgG;AAEhG,wCAAmC;AAEnC;;;;;;;;GAQG;AACH,SAAgB,QAAQ;IACtB,MAAM,QAAQ,GAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,E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C;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,GAAG,GAAG,CAAC,MAAM,KACX,GAAG,CAAC,UACN,4DAA4D,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CAC/E,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAiB,CAAC;QACtF,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG;YACb,MAAM;YACN,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;YAC1C,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;SAC3C,CAAC;QACF,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,IAAA,qBAAa,EAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1G,CAAC;QACD,OAAO,IAAA,2BAAmB,EAAC,MAAM,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
|
package/code-tool.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { asTextContentResult } from "./types.mjs";
|
|
2
|
+
import { asErrorResult, asTextContentResult } from "./types.mjs";
|
|
3
3
|
import { readEnv } from "./server.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* A tool that runs code against a copy of the SDK.
|
|
@@ -38,14 +38,24 @@ export function codeTool() {
|
|
|
38
38
|
},
|
|
39
39
|
body: JSON.stringify({
|
|
40
40
|
project_name: 'finch',
|
|
41
|
-
client_opts: { accessToken: readEnv('FINCH_ACCESS_TOKEN') },
|
|
42
41
|
code,
|
|
42
|
+
client_opts: { accessToken: readEnv('FINCH_ACCESS_TOKEN') },
|
|
43
43
|
}),
|
|
44
44
|
});
|
|
45
45
|
if (!res.ok) {
|
|
46
46
|
throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
const { is_error, result, log_lines, err_lines } = (await res.json());
|
|
49
|
+
const hasLogs = log_lines.length > 0 || err_lines.length > 0;
|
|
50
|
+
const output = {
|
|
51
|
+
result,
|
|
52
|
+
...(log_lines.length > 0 && { log_lines }),
|
|
53
|
+
...(err_lines.length > 0 && { err_lines }),
|
|
54
|
+
};
|
|
55
|
+
if (is_error) {
|
|
56
|
+
return asErrorResult(typeof result === 'string' && !hasLogs ? result : JSON.stringify(output, null, 2));
|
|
57
|
+
}
|
|
58
|
+
return asTextContentResult(output);
|
|
49
59
|
};
|
|
50
60
|
return { metadata, tool, handler };
|
|
51
61
|
}
|
package/code-tool.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.mjs","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAqC,mBAAmB,EAAE;
|
|
1
|
+
{"version":3,"file":"code-tool.mjs","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAqC,aAAa,EAAE,mBAAmB,EAAE;OAEzE,EAAE,OAAO,EAAE;AAElB;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,QAAQ,GAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,E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AAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,GAAG,GAAG,CAAC,MAAM,KACX,GAAG,CAAC,UACN,4DAA4D,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CAC/E,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAiB,CAAC;QACtF,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG;YACb,MAAM;YACN,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;YAC1C,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;SAC3C,CAAC;QACF,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,aAAa,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1G,CAAC;QACD,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryfinch/finch-api-mcp",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "The official MCP Server for the Finch API",
|
|
5
5
|
"author": "Finch <founders@tryfinch.com>",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"fix": "eslint --fix --ext ts,js ."
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tryfinch/finch-api": "^8.
|
|
30
|
+
"@tryfinch/finch-api": "^8.1.1",
|
|
31
31
|
"@cloudflare/cabidela": "^0.2.4",
|
|
32
32
|
"@modelcontextprotocol/sdk": "^1.24.0",
|
|
33
33
|
"@valtown/deno-http-worker": "^0.0.21",
|
package/server.js
CHANGED
|
@@ -15,7 +15,7 @@ const code_tool_1 = require("./code-tool.js");
|
|
|
15
15
|
const docs_search_tool_1 = __importDefault(require("./docs-search-tool.js"));
|
|
16
16
|
const newMcpServer = () => new mcp_js_1.McpServer({
|
|
17
17
|
name: 'tryfinch_finch_api_api',
|
|
18
|
-
version: '8.
|
|
18
|
+
version: '8.1.1',
|
|
19
19
|
}, { capabilities: { tools: {}, logging: {} } });
|
|
20
20
|
exports.newMcpServer = newMcpServer;
|
|
21
21
|
// Create server instance
|
package/server.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { codeTool } from "./code-tool.mjs";
|
|
|
6
6
|
import docsSearchTool from "./docs-search-tool.mjs";
|
|
7
7
|
export const newMcpServer = () => new McpServer({
|
|
8
8
|
name: 'tryfinch_finch_api_api',
|
|
9
|
-
version: '8.
|
|
9
|
+
version: '8.1.1',
|
|
10
10
|
}, { capabilities: { tools: {}, logging: {} } });
|
|
11
11
|
// Create server instance
|
|
12
12
|
export const server = newMcpServer();
|
package/src/code-tool-types.ts
CHANGED
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
import { ClientOptions } from '@tryfinch/finch-api';
|
|
4
4
|
|
|
5
5
|
export type WorkerInput = {
|
|
6
|
-
|
|
6
|
+
project_name: string;
|
|
7
7
|
code: string;
|
|
8
|
+
client_opts: ClientOptions;
|
|
8
9
|
};
|
|
9
|
-
export type
|
|
10
|
+
export type WorkerOutput = {
|
|
11
|
+
is_error: boolean;
|
|
10
12
|
result: unknown | null;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
export type WorkerError = {
|
|
15
|
-
message: string | undefined;
|
|
16
|
-
logLines: string[];
|
|
17
|
-
errLines: string[];
|
|
13
|
+
log_lines: string[];
|
|
14
|
+
err_lines: string[];
|
|
18
15
|
};
|
package/src/code-tool.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { McpTool, Metadata, ToolCallResult, asTextContentResult } from './types';
|
|
3
|
+
import { McpTool, Metadata, ToolCallResult, asErrorResult, asTextContentResult } from './types';
|
|
4
4
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import { readEnv } from './server';
|
|
6
|
-
import {
|
|
6
|
+
import { WorkerInput, WorkerOutput } from './code-tool-types';
|
|
7
7
|
/**
|
|
8
8
|
* A tool that runs code against a copy of the SDK.
|
|
9
9
|
*
|
|
@@ -45,9 +45,9 @@ export function codeTool(): McpTool {
|
|
|
45
45
|
},
|
|
46
46
|
body: JSON.stringify({
|
|
47
47
|
project_name: 'finch',
|
|
48
|
-
client_opts: { accessToken: readEnv('FINCH_ACCESS_TOKEN') },
|
|
49
48
|
code,
|
|
50
|
-
|
|
49
|
+
client_opts: { accessToken: readEnv('FINCH_ACCESS_TOKEN') },
|
|
50
|
+
} satisfies WorkerInput),
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
if (!res.ok) {
|
|
@@ -58,7 +58,17 @@ export function codeTool(): McpTool {
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
const { is_error, result, log_lines, err_lines } = (await res.json()) as WorkerOutput;
|
|
62
|
+
const hasLogs = log_lines.length > 0 || err_lines.length > 0;
|
|
63
|
+
const output = {
|
|
64
|
+
result,
|
|
65
|
+
...(log_lines.length > 0 && { log_lines }),
|
|
66
|
+
...(err_lines.length > 0 && { err_lines }),
|
|
67
|
+
};
|
|
68
|
+
if (is_error) {
|
|
69
|
+
return asErrorResult(typeof result === 'string' && !hasLogs ? result : JSON.stringify(output, null, 2));
|
|
70
|
+
}
|
|
71
|
+
return asTextContentResult(output);
|
|
62
72
|
};
|
|
63
73
|
|
|
64
74
|
return { metadata, tool, handler };
|