diff options
| author | Dax Raad <[email protected]> | 2025-07-07 17:05:16 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-07-07 17:05:16 -0400 |
| commit | 0d50c867ff16686d47101fa6d29e07539fe40d8f (patch) | |
| tree | 00fbe0759c6eadfb445080f3545acce607059f78 /packages | |
| parent | 27f7e02f12a1f0291d141686ecdedb72127a6523 (diff) | |
| download | opencode-0d50c867ff16686d47101fa6d29e07539fe40d8f.tar.gz opencode-0d50c867ff16686d47101fa6d29e07539fe40d8f.zip | |
fix mcp tools corrupting session
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/session/index.ts | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts index 4c50d51d5..4e24fa517 100644 --- a/packages/opencode/src/session/index.ts +++ b/packages/opencode/src/session/index.ts @@ -496,14 +496,20 @@ export namespace Session { const execute = item.execute if (!execute) continue item.execute = async (args, opts) => { - try { - const result = await execute(args, opts) - return result.content - .filter((x: any) => x.type === "text") - .map((x: any) => x.text) - .join("\n\n") - } catch (e: any) { - return e.toString() + const result = await execute(args, opts) + const output = result.content + .filter((x: any) => x.type === "text") + .map((x: any) => x.text) + .join("\n\n") + + return { + output, + } + } + item.toModelOutput = (result) => { + return { + type: "text", + value: result.output, } } tools[key] = item |
