GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(mcp): handle tool result errors (#32244) · comio/opencode@dfb616f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/opencode/src/mcp
    • catalog.ts
  • patches
    • @modelcontextprotocol%[email protected]
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/opencode/src/mcp/catalog.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/mcp/catalog.ts
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ export function convertTool(mcpTool: MCPToolDef, client: Client, timeout?: numbe
6363
timeout,
6464
},
6565
)
66+
if (result.isError)
67+
throw new Error(
68+
result.content
69+
.flatMap((item) => (item.type === "text" ? [item.text] : []))
70+
.filter((text) => text.trim())
71+
.join("\n\n") || "MCP tool returned an error",
72+
)
6673
if (result.structuredContent === undefined || result.structuredContent === null) return result
6774
return {
6875
...result,
Collapse file

‎patches/@modelcontextprotocol%[email protected]‎

Copy file name to clipboardExpand all lines: patches/@modelcontextprotocol%[email protected]
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
diff --git a/dist/cjs/client/index.d.ts b/dist/cjs/client/index.d.ts
2+
index 1822bf749aec71d2bb295083d832114ee187bb67..58b859a7b32222fb5cb9f2011fdc5d010f3d05fb 100644
3+
--- a/dist/cjs/client/index.d.ts
4+
+++ b/dist/cjs/client/index.d.ts
5+
@@ -428,6 +428,8 @@ export declare class Client<RequestT extends Request = Request, NotificationT ex
6+
*
7+
* For task-based execution with streaming behavior, use client.experimental.tasks.callToolStream() instead.
8+
*/
9+
+ callTool(params: CallToolRequest['params'], resultSchema?: undefined, options?: RequestOptions): Promise<SchemaOutput<typeof CallToolResultSchema>>;
10+
+ callTool<T extends typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema>(params: CallToolRequest['params'], resultSchema: T, options?: RequestOptions): Promise<SchemaOutput<T>>;
11+
callTool(params: CallToolRequest['params'], resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<{
12+
[x: string]: unknown;
13+
content: ({
14+
diff --git a/dist/esm/client/index.d.ts b/dist/esm/client/index.d.ts
15+
index 1822bf749aec71d2bb295083d832114ee187bb67..58b859a7b32222fb5cb9f2011fdc5d010f3d05fb 100644
16+
--- a/dist/esm/client/index.d.ts
17+
+++ b/dist/esm/client/index.d.ts
18+
@@ -428,6 +428,8 @@ export declare class Client<RequestT extends Request = Request, NotificationT ex
19+
*
20+
* For task-based execution with streaming behavior, use client.experimental.tasks.callToolStream() instead.
21+
*/
22+
+ callTool(params: CallToolRequest['params'], resultSchema?: undefined, options?: RequestOptions): Promise<SchemaOutput<typeof CallToolResultSchema>>;
23+
+ callTool<T extends typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema>(params: CallToolRequest['params'], resultSchema: T, options?: RequestOptions): Promise<SchemaOutput<T>>;
24+
callTool(params: CallToolRequest['params'], resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<{
25+
[x: string]: unknown;
26+
content: ({
127
diff --git a/dist/cjs/client/index.js b/dist/cjs/client/index.js
228
index 6ac1da14dc7f6211ae70f7711c124b76098816d8..adb5b7bd45514a406a0f7e40b64631c101584c84 100644
329
--- a/dist/cjs/client/index.js

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.