internal/mcp: handle synthetic responses in conformance test
Modify the conformance test driver to support outgoing responses. They are returned for incoming requests in order. Add a test that returns a file resource, which involves the server sending a roots/list request to the client. Change-Id: Ie7eb69a8c99ccbf11721518cfffb21244c03e532 Reviewed-on: https://go-review.googlesource.com/c/tools/+/677475 Commit-Queue: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
a627a4a2dd
commit
2b9c6bff50
1 changed files with 108 additions and 23 deletions
39
mcp/testdata/conformance/server/resources.txtar
vendored
39
mcp/testdata/conformance/server/resources.txtar
vendored
|
|
@ -5,6 +5,7 @@ Fixed bugs:
|
|||
|
||||
-- resources --
|
||||
info
|
||||
info.txt
|
||||
|
||||
-- client --
|
||||
{
|
||||
|
|
@ -25,6 +26,19 @@ info
|
|||
"uri": "embedded:info"
|
||||
}
|
||||
}
|
||||
{
|
||||
"jsonrpc": "2.0", "id": 3,
|
||||
"method": "resources/read",
|
||||
"params": {
|
||||
"uri": "file:///info.txt"
|
||||
}
|
||||
}
|
||||
{
|
||||
"jsonrpc": "2.0", "id": 0,
|
||||
"result": {
|
||||
"roots": []
|
||||
}
|
||||
}
|
||||
-- server --
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
|
|
@ -61,6 +75,11 @@ info
|
|||
"mimeType": "text/plain",
|
||||
"name": "info",
|
||||
"uri": "embedded:info"
|
||||
},
|
||||
{
|
||||
"mimeType": "text/plain",
|
||||
"name": "public",
|
||||
"uri": "file:///info.txt"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -79,3 +98,23 @@ info
|
|||
]
|
||||
}
|
||||
}
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"method": "roots/list",
|
||||
"params": null
|
||||
}
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 3,
|
||||
"result": {
|
||||
"_meta": {},
|
||||
"contents": [
|
||||
{
|
||||
"uri": "file:///info.txt",
|
||||
"mimeType": "text/plain",
|
||||
"blob": "Q29udGVudHMK"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue