diff options
| author | Olcan <[email protected]> | 2025-05-30 15:59:23 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-30 15:59:23 -0700 |
| commit | c81148a0cc8489f657901c2cc7247c0834075e1a (patch) | |
| tree | 896711ba726b36ecd85f143b30bb30bbefcaeb5c /packages/server/src | |
| parent | 2e57989aec569055a11f21762f72b961377281ab (diff) | |
use json block for mcp tool output (and re-enable markdown rendering) (#635)
Diffstat (limited to 'packages/server/src')
| -rw-r--r-- | packages/server/src/tools/mcp-tool.test.ts | 3 | ||||
| -rw-r--r-- | packages/server/src/tools/mcp-tool.ts | 7 | ||||
| -rw-r--r-- | packages/server/src/tools/tool-registry.test.ts | 3 |
3 files changed, 8 insertions, 5 deletions
diff --git a/packages/server/src/tools/mcp-tool.test.ts b/packages/server/src/tools/mcp-tool.test.ts index 331696f7..5c784c5d 100644 --- a/packages/server/src/tools/mcp-tool.test.ts +++ b/packages/server/src/tools/mcp-tool.test.ts @@ -116,7 +116,8 @@ describe('DiscoveredMCPTool', () => { timeout: MCP_TOOL_DEFAULT_TIMEOUT_MSEC, }, ); - const expectedOutput = JSON.stringify(expectedMcpResult, null, 2); + const expectedOutput = + '```json\n' + JSON.stringify(expectedMcpResult, null, 2) + '\n```'; expect(result.llmContent).toBe(expectedOutput); expect(result.returnDisplay).toBe(expectedOutput); }); diff --git a/packages/server/src/tools/mcp-tool.ts b/packages/server/src/tools/mcp-tool.ts index 80e6bbde..d02b8632 100644 --- a/packages/server/src/tools/mcp-tool.ts +++ b/packages/server/src/tools/mcp-tool.ts @@ -42,7 +42,7 @@ Returns the MCP server response as a json string. name, description, parameterSchema, - false, // isOutputMarkdown + true, // isOutputMarkdown false, // canUpdateOutput ); } @@ -93,9 +93,10 @@ Returns the MCP server response as a json string. timeout: this.timeout ?? MCP_TOOL_DEFAULT_TIMEOUT_MSEC, }, ); + const output = '```json\n' + JSON.stringify(result, null, 2) + '\n```'; return { - llmContent: JSON.stringify(result, null, 2), - returnDisplay: JSON.stringify(result, null, 2), + llmContent: output, + returnDisplay: output, }; } } diff --git a/packages/server/src/tools/tool-registry.test.ts b/packages/server/src/tools/tool-registry.test.ts index c93109ae..121e91c8 100644 --- a/packages/server/src/tools/tool-registry.test.ts +++ b/packages/server/src/tools/tool-registry.test.ts @@ -768,7 +768,8 @@ describe('DiscoveredMCPTool', () => { timeout: 10 * 60 * 1000, }, ); - const expectedOutput = JSON.stringify(mcpResult, null, 2); + const expectedOutput = + '```json\n' + JSON.stringify(mcpResult, null, 2) + '\n```'; expect(result.llmContent).toBe(expectedOutput); expect(result.returnDisplay).toBe(expectedOutput); }); |
