Skip to content

Commit 990c381

Browse files
authored
Merge pull request modelcontextprotocol#176 from modelcontextprotocol/davidsp/tool-results
servers: make tool call result spec compatible
2 parents a6f33d6 + f503654 commit 990c381

File tree

19 files changed

+368
-1471
lines changed

19 files changed

+368
-1471
lines changed

package-lock.json

Lines changed: 88 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/brave-search/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"watch": "tsc --watch"
2020
},
2121
"dependencies": {
22-
"@modelcontextprotocol/sdk": "0.5.0"
22+
"@modelcontextprotocol/sdk": "1.0.1"
2323
},
2424
"devDependencies": {
2525
"@types/node": "^20.10.0",

src/everything/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"watch": "tsc --watch"
2020
},
2121
"dependencies": {
22-
"@modelcontextprotocol/sdk": "0.5.0",
22+
"@modelcontextprotocol/sdk": "1.0.1",
2323
"express": "^4.21.1",
2424
"zod": "^3.23.8",
2525
"zod-to-json-schema": "^3.23.5"

src/filesystem/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"watch": "tsc --watch"
2020
},
2121
"dependencies": {
22-
"@modelcontextprotocol/sdk": "0.5.0",
22+
"@modelcontextprotocol/sdk": "1.0.1",
2323
"glob": "^10.3.10",
2424
"zod-to-json-schema": "^3.23.5"
2525
},

src/gdrive/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"dependencies": {
2222
"@google-cloud/local-auth": "^3.0.1",
23-
"@modelcontextprotocol/sdk": "0.5.0",
23+
"@modelcontextprotocol/sdk": "1.0.1",
2424
"googleapis": "^144.0.0"
2525
},
2626
"devDependencies": {

src/github/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
529529
case "fork_repository": {
530530
const args = ForkRepositorySchema.parse(request.params.arguments);
531531
const fork = await forkRepository(args.owner, args.repo, args.organization);
532-
return { toolResult: fork };
532+
return { content: [{ type: "text", text: JSON.stringify(fork, null, 2) }] };
533533
}
534534

535535
case "create_branch": {
@@ -562,25 +562,25 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
562562
sha
563563
});
564564

565-
return { toolResult: branch };
565+
return { content: [{ type: "text", text: JSON.stringify(branch, null, 2) }] };
566566
}
567567

568568
case "search_repositories": {
569569
const args = SearchRepositoriesSchema.parse(request.params.arguments);
570570
const results = await searchRepositories(args.query, args.page, args.perPage);
571-
return { toolResult: results };
571+
return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] };
572572
}
573573

574574
case "create_repository": {
575575
const args = CreateRepositorySchema.parse(request.params.arguments);
576576
const repository = await createRepository(args);
577-
return { toolResult: repository };
577+
return { content: [{ type: "text", text: JSON.stringify(repository, null, 2) }] };
578578
}
579579

580580
case "get_file_contents": {
581581
const args = GetFileContentsSchema.parse(request.params.arguments);
582582
const contents = await getFileContents(args.owner, args.repo, args.path, args.branch);
583-
return { toolResult: contents };
583+
return { content: [{ type: "text", text: JSON.stringify(contents, null, 2) }] };
584584
}
585585

586586
case "create_or_update_file": {
@@ -594,7 +594,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
594594
args.branch,
595595
args.sha
596596
);
597-
return { toolResult: result };
597+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
598598
}
599599

600600
case "push_files": {
@@ -606,21 +606,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
606606
args.files,
607607
args.message
608608
);
609-
return { toolResult: result };
609+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
610610
}
611611

612612
case "create_issue": {
613613
const args = CreateIssueSchema.parse(request.params.arguments);
614614
const { owner, repo, ...options } = args;
615615
const issue = await createIssue(owner, repo, options);
616-
return { toolResult: issue };
616+
return { content: [{ type: "text", text: JSON.stringify(issue, null, 2) }] };
617617
}
618618

619619
case "create_pull_request": {
620620
const args = CreatePullRequestSchema.parse(request.params.arguments);
621621
const { owner, repo, ...options } = args;
622622
const pullRequest = await createPullRequest(owner, repo, options);
623-
return { toolResult: pullRequest };
623+
return { content: [{ type: "text", text: JSON.stringify(pullRequest, null, 2) }] };
624624
}
625625

626626
default:

0 commit comments

Comments
 (0)