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:
Jonathan Amsterdam 2025-05-29 13:48:50 -04:00
commit 2b9c6bff50

View file

@ -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"
}
]
}
}