Update ServerSession so that the session is not marked as initialized until 'notifications/initialized' is actually received from the client. Include a new test of this lifecycle strictness. Fixes #225
91 lines
1.6 KiB
Text
91 lines
1.6 KiB
Text
Check behavior of a server with just tools.
|
|
|
|
Fixed bugs:
|
|
- "tools/list" can have missing params
|
|
- "_meta" should not be nil
|
|
- empty resource or prompts should not be returned as 'null'
|
|
- the server should not crash when params are passed to tools/call
|
|
|
|
-- tools --
|
|
greet
|
|
|
|
-- client --
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 1,
|
|
"method": "initialize",
|
|
"params": {
|
|
"protocolVersion": "2024-11-05",
|
|
"capabilities": {},
|
|
"clientInfo": { "name": "ExampleClient", "version": "1.0.0" }
|
|
}
|
|
}
|
|
{"jsonrpc":"2.0", "method": "notifications/initialized"}
|
|
{ "jsonrpc": "2.0", "id": 2, "method": "tools/list" }
|
|
{ "jsonrpc": "2.0", "id": 3, "method": "resources/list" }
|
|
{ "jsonrpc": "2.0", "id": 4, "method": "prompts/list" }
|
|
{ "jsonrpc": "2.0", "id": 5, "method": "tools/call" }
|
|
-- server --
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 1,
|
|
"result": {
|
|
"capabilities": {
|
|
"logging": {},
|
|
"tools": {
|
|
"listChanged": true
|
|
}
|
|
},
|
|
"protocolVersion": "2024-11-05",
|
|
"serverInfo": {
|
|
"name": "testServer",
|
|
"version": "v1.0.0"
|
|
}
|
|
}
|
|
}
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 2,
|
|
"result": {
|
|
"tools": [
|
|
{
|
|
"description": "say hi",
|
|
"inputSchema": {
|
|
"type": "object",
|
|
"required": [
|
|
"Name"
|
|
],
|
|
"properties": {
|
|
"Name": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"name": "greet"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 3,
|
|
"result": {
|
|
"resources": []
|
|
}
|
|
}
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 4,
|
|
"result": {
|
|
"prompts": []
|
|
}
|
|
}
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 5,
|
|
"error": {
|
|
"code": -32600,
|
|
"message": "invalid request: missing required \"params\""
|
|
}
|
|
}
|