fix: advertise MCP tools capability explicitly
This commit is contained in:
parent
92fc30cb2d
commit
f10b797640
2 changed files with 10 additions and 1 deletions
|
|
@ -341,7 +341,9 @@ func (r Runner) handleInitialize(encoder *json.Encoder, session *runnerSession,
|
||||||
return writeRPCResult(encoder, request.ID, map[string]any{
|
return writeRPCResult(encoder, request.ID, map[string]any{
|
||||||
"protocolVersion": negotiatedVersion,
|
"protocolVersion": negotiatedVersion,
|
||||||
"capabilities": map[string]any{
|
"capabilities": map[string]any{
|
||||||
"tools": map[string]any{},
|
"tools": map[string]any{
|
||||||
|
"listChanged": true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"serverInfo": map[string]any{
|
"serverInfo": map[string]any{
|
||||||
"name": mcpServerName,
|
"name": mcpServerName,
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,13 @@ func TestRunnerRunWritesToolManifestAndHandlesRequests(t *testing.T) {
|
||||||
if _, ok := initializeResponse.Result.Capabilities["tools"]; !ok {
|
if _, ok := initializeResponse.Result.Capabilities["tools"]; !ok {
|
||||||
t.Fatalf("expected tools capability, got %#v", initializeResponse.Result.Capabilities)
|
t.Fatalf("expected tools capability, got %#v", initializeResponse.Result.Capabilities)
|
||||||
}
|
}
|
||||||
|
toolsCapability, ok := initializeResponse.Result.Capabilities["tools"].(map[string]any)
|
||||||
|
if !ok {
|
||||||
|
t.Fatalf("expected tools capability object, got %#v", initializeResponse.Result.Capabilities["tools"])
|
||||||
|
}
|
||||||
|
if listChanged, ok := toolsCapability["listChanged"].(bool); !ok || !listChanged {
|
||||||
|
t.Fatalf("expected tools.listChanged=true, got %#v", toolsCapability)
|
||||||
|
}
|
||||||
if initializeResponse.Result.ServerInfo.Name == "" || initializeResponse.Result.ServerInfo.Version == "" {
|
if initializeResponse.Result.ServerInfo.Name == "" || initializeResponse.Result.ServerInfo.Version == "" {
|
||||||
t.Fatalf("expected server info, got %#v", initializeResponse.Result.ServerInfo)
|
t.Fatalf("expected server info, got %#v", initializeResponse.Result.ServerInfo)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue