see it works with real servers

This commit is contained in:
lda
2026-04-29 22:11:26 +07:00 Verified
parent 0461459106
commit 8337d7615c
2 changed files with 44 additions and 0 deletions
+23
View File
@@ -11,5 +11,28 @@ async def echo_tool(text: str) -> dict[str, str]:
return {"echoed": text}
@server.resource(
"fixture://docs/welcome",
name="resource.welcome",
description="Welcome text resource for fixture tests.",
mime_type="text/plain",
)
def welcome_resource() -> str:
return "Welcome from the fixture MCP server."
@server.prompt(
name="prompt.summarize",
description="Summarize an input text for fixture tests.",
)
def summarize_prompt(text: str) -> list[dict[str, object]]:
return [
{
"role": "user",
"content": f"Summarize this text:\n\n{text}",
}
]
if __name__ == "__main__":
server.run("stdio")
+21
View File
@@ -37,6 +37,27 @@ def test_mcp_sdk_adapter_lists_and_calls_stdio_tool() -> None:
payload = service.get_catalog().as_payload()
assert payload["nodes"][0]["qualified_name"] == "fixture.personal.echo_tool"
assert payload["resources"] == [
{
"qualified_name": "fixture.personal.resource.welcome",
"connection_id": "fixture.personal",
"local_name": "resource.welcome",
"uri": "fixture://docs/welcome",
"description": "Welcome text resource for fixture tests.",
"mime_type": "text/plain",
"metadata": payload["resources"][0]["metadata"],
}
]
assert payload["prompts"] == [
{
"qualified_name": "fixture.personal.prompt.summarize",
"connection_id": "fixture.personal",
"local_name": "prompt.summarize",
"description": "Summarize an input text for fixture tests.",
"arguments": payload["prompts"][0]["arguments"],
"metadata": payload["prompts"][0]["metadata"],
}
]
adapter = McpSdkAdapter()
try: