see it works with real servers
This commit is contained in:
Vendored
+23
@@ -11,5 +11,28 @@ async def echo_tool(text: str) -> dict[str, str]:
|
|||||||
return {"echoed": text}
|
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__":
|
if __name__ == "__main__":
|
||||||
server.run("stdio")
|
server.run("stdio")
|
||||||
|
|||||||
@@ -37,6 +37,27 @@ def test_mcp_sdk_adapter_lists_and_calls_stdio_tool() -> None:
|
|||||||
|
|
||||||
payload = service.get_catalog().as_payload()
|
payload = service.get_catalog().as_payload()
|
||||||
assert payload["nodes"][0]["qualified_name"] == "fixture.personal.echo_tool"
|
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()
|
adapter = McpSdkAdapter()
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user