Merge pull request #1701 from ck0park/fix/list-corpora-mcp-result-shape

fix: list_corpora MCP tool — wrap response in CallToolResult shape (fixes #1700)
This commit is contained in:
Alex Newman
2026-04-14 18:41:13 -07:00
committed by GitHub
@@ -72,7 +72,14 @@ export class CorpusRoutes extends BaseRouteHandler {
*/
private handleListCorpora = this.wrapHandler((_req: Request, res: Response): void => {
const corpora = this.corpusStore.list();
res.json(corpora);
// Wrap in MCP CallToolResult shape so the MCP server wrapper (callWorkerAPI)
// can forward it without failing tools/call schema validation.
// See: #1700 — every other corpus endpoint is a POST that already returns
// {content:[...]}, but this GET used to return a bare array, which MCP
// rejects with "expected object, received array".
res.json({
content: [{ type: 'text', text: JSON.stringify(corpora, null, 2) }]
});
});
/**