An incident-desk MCP server with a fixed resource, two resource templates, a prompt, a tool that borrows the client's model (sampling) and a tool that asks the operator to approve a restart (elicitation). Driven by a plain SDK client in JUnit and by raw curl, so the JSON-RPC for both server-to-client requests is committed. Also captured: a client that declared neither capability (a gated tool degrades, an ungated one returns an isError result), a slow client hitting the server request timeout, and protocol=STATELESS silently dropping every tool that takes McpSyncRequestContext (one WARN line, an empty tools/list). Negotiated protocol version is 2025-11-25; the 2026-07-28 spec is not implemented by SDK 2.1.0. No docs/ folder. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5jAFLJrmUXmbo5EuV
57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
# sampling/createMessage on the wire
|
|
|
|
## 1. client -> server (POST, answers arrive later on the same session)
|
|
tools/call summarize_incident {"incidentId":"INC-1043"}
|
|
|
|
## 2. server -> client, on the SSE stream of that same POST
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"method": "sampling/createMessage",
|
|
"id": "7899c995-7e19-45a9-8b27-a043acabe802-0",
|
|
"params": {
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": {
|
|
"type": "text",
|
|
"text": "Summarize this incident log:\n11:02:44 search-api WARN index segment merge running\n11:02:51 search-api INFO p99 latency 840ms (SLO 500ms)\n"
|
|
}
|
|
}
|
|
],
|
|
"systemPrompt": "You are an SRE. Answer in two sentences, no preamble.",
|
|
"includeContext": "none",
|
|
"temperature": 0.2,
|
|
"maxTokens": 120
|
|
}
|
|
}
|
|
|
|
## 3. client -> server, a NEW POST carrying the answer (same id as the server's request)
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": "7899c995-7e19-45a9-8b27-a043acabe802-0",
|
|
"result": {
|
|
"role": "assistant",
|
|
"content": {
|
|
"type": "text",
|
|
"text": "A segment merge pushed p99 to 840ms against a 500ms SLO."
|
|
},
|
|
"model": "curl-model",
|
|
"stopReason": "endTurn"
|
|
}
|
|
}
|
|
|
|
## 4. server -> client, the original tools/call finally completes
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 7,
|
|
"result": {
|
|
"content": [
|
|
{
|
|
"type": "text",
|
|
"text": "A segment merge pushed p99 to 840ms against a 500ms SLO."
|
|
}
|
|
],
|
|
"isError": false
|
|
}
|
|
}
|