Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

servers: make tool call result spec compatible #176

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 88 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/brave-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"watch": "tsc --watch"
},
"dependencies": {
"@modelcontextprotocol/sdk": "0.5.0"
"@modelcontextprotocol/sdk": "1.0.1"
},
"devDependencies": {
"@types/node": "^20.10.0",
Expand Down
2 changes: 1 addition & 1 deletion src/everything/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"watch": "tsc --watch"
},
"dependencies": {
"@modelcontextprotocol/sdk": "0.5.0",
"@modelcontextprotocol/sdk": "1.0.1",
"express": "^4.21.1",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.5"
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"watch": "tsc --watch"
},
"dependencies": {
"@modelcontextprotocol/sdk": "0.5.0",
"@modelcontextprotocol/sdk": "1.0.1",
"glob": "^10.3.10",
"zod-to-json-schema": "^3.23.5"
},
Expand Down
2 changes: 1 addition & 1 deletion src/gdrive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@google-cloud/local-auth": "^3.0.1",
"@modelcontextprotocol/sdk": "0.5.0",
"@modelcontextprotocol/sdk": "1.0.1",
"googleapis": "^144.0.0"
},
"devDependencies": {
Expand Down
18 changes: 9 additions & 9 deletions src/github/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
case "fork_repository": {
const args = ForkRepositorySchema.parse(request.params.arguments);
const fork = await forkRepository(args.owner, args.repo, args.organization);
return { toolResult: fork };
return { content: [{ type: "text", text: JSON.stringify(fork, null, 2) }] };
}

case "create_branch": {
Expand Down Expand Up @@ -562,25 +562,25 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
sha
});

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

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

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

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

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

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

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

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

default:
Expand Down
Loading
Loading