use json block for mcp tool output (and re-enable markdown rendering) (#635)
This commit is contained in:
parent
2e57989aec
commit
c81148a0cc
|
@ -116,7 +116,8 @@ describe('DiscoveredMCPTool', () => {
|
||||||
timeout: MCP_TOOL_DEFAULT_TIMEOUT_MSEC,
|
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.llmContent).toBe(expectedOutput);
|
||||||
expect(result.returnDisplay).toBe(expectedOutput);
|
expect(result.returnDisplay).toBe(expectedOutput);
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,7 +42,7 @@ Returns the MCP server response as a json string.
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
parameterSchema,
|
parameterSchema,
|
||||||
false, // isOutputMarkdown
|
true, // isOutputMarkdown
|
||||||
false, // canUpdateOutput
|
false, // canUpdateOutput
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -93,9 +93,10 @@ Returns the MCP server response as a json string.
|
||||||
timeout: this.timeout ?? MCP_TOOL_DEFAULT_TIMEOUT_MSEC,
|
timeout: this.timeout ?? MCP_TOOL_DEFAULT_TIMEOUT_MSEC,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
const output = '```json\n' + JSON.stringify(result, null, 2) + '\n```';
|
||||||
return {
|
return {
|
||||||
llmContent: JSON.stringify(result, null, 2),
|
llmContent: output,
|
||||||
returnDisplay: JSON.stringify(result, null, 2),
|
returnDisplay: output,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -768,7 +768,8 @@ describe('DiscoveredMCPTool', () => {
|
||||||
timeout: 10 * 60 * 1000,
|
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.llmContent).toBe(expectedOutput);
|
||||||
expect(result.returnDisplay).toBe(expectedOutput);
|
expect(result.returnDisplay).toBe(expectedOutput);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue