This uncovered a problem in how we represent resource results: contents is a slice, not a single value. I tried to use a file resource, but the server->client ListRoots call didn't work because synthetic responses aren't supported. Left a TODO. I enhanced the hello example so I that could use the MCP Inspector to work with resources. The falseSchema change fixes a potential bug where schemas are re-used, which is disallowed. Change-Id: I1f0198043cb6221c2a03f4f83aa0bafbc71167f4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/677136 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Jonathan Amsterdam <jba@google.com>
81 lines
1.3 KiB
Text
81 lines
1.3 KiB
Text
Check behavior of a server with just resources.
|
|
|
|
Fixed bugs:
|
|
- A resource result holds a slice of contents, not just one.
|
|
|
|
-- resources --
|
|
info
|
|
|
|
-- client --
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 1,
|
|
"method": "initialize",
|
|
"params": {
|
|
"protocolVersion": "2024-11-05",
|
|
"capabilities": {},
|
|
"clientInfo": { "name": "ExampleClient", "version": "1.0.0" }
|
|
}
|
|
}
|
|
{ "jsonrpc": "2.0", "id": 2, "method": "resources/list" }
|
|
{
|
|
"jsonrpc": "2.0", "id": 3,
|
|
"method": "resources/read",
|
|
"params": {
|
|
"uri": "embedded:info"
|
|
}
|
|
}
|
|
-- server --
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 1,
|
|
"result": {
|
|
"_meta": {},
|
|
"capabilities": {
|
|
"completions": {},
|
|
"logging": {},
|
|
"prompts": {
|
|
"listChanged": true
|
|
},
|
|
"resources": {
|
|
"listChanged": true
|
|
},
|
|
"tools": {
|
|
"listChanged": true
|
|
}
|
|
},
|
|
"protocolVersion": "2024-11-05",
|
|
"serverInfo": {
|
|
"name": "testServer",
|
|
"version": "v1.0.0"
|
|
}
|
|
}
|
|
}
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 2,
|
|
"result": {
|
|
"_meta": {},
|
|
"resources": [
|
|
{
|
|
"mimeType": "text/plain",
|
|
"name": "info",
|
|
"uri": "embedded:info"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 3,
|
|
"result": {
|
|
"_meta": {},
|
|
"contents": [
|
|
{
|
|
"uri": "embedded:info",
|
|
"mimeType": "text/plain",
|
|
"text": "This is the MCP test server."
|
|
}
|
|
]
|
|
}
|
|
}
|