From 8cd523899263dbdc032083b31d6864abadfca209 Mon Sep 17 00:00:00 2001 From: Alexandros Pappas Date: Sun, 22 Dec 2024 12:05:36 +0100 Subject: [PATCH] fix: Correctly structure tool responses Refactored list_issues, update_issue, add_issue_comment, and get_issue tools to return their responses in the correct MCP `content` structure following the spec https://github.com/modelcontextprotocol/specification/blob/main/schema/schema.json#L80 --- src/github/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/github/index.ts b/src/github/index.ts index 3759e8b5..981c12e5 100644 --- a/src/github/index.ts +++ b/src/github/index.ts @@ -978,21 +978,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => { const args = ListIssuesOptionsSchema.parse(request.params.arguments); const { owner, repo, ...options } = args; const issues = await listIssues(owner, repo, options); - return { toolResult: issues }; + return { content: [{ type: "text", text: JSON.stringify(issues, null, 2) }] }; } case "update_issue": { const args = UpdateIssueOptionsSchema.parse(request.params.arguments); const { owner, repo, issue_number, ...options } = args; const issue = await updateIssue(owner, repo, issue_number, options); - return { toolResult: issue }; + return { content: [{ type: "text", text: JSON.stringify(issue, null, 2) }] }; } case "add_issue_comment": { const args = IssueCommentSchema.parse(request.params.arguments); const { owner, repo, issue_number, body } = args; const comment = await addIssueComment(owner, repo, issue_number, body); - return { toolResult: comment }; + return { content: [{ type: "text", text: JSON.stringify(comment, null, 2) }] }; } case "list_commits": { @@ -1008,7 +1008,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => { issue_number: z.number() }).parse(request.params.arguments); const issue = await getIssue(args.owner, args.repo, args.issue_number); - return { toolResult: issue }; + return { content: [{ type: "text", text: JSON.stringify(issue, null, 2) }] }; } default: