prompts and resources as tools
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from fastmcp import Client
|
||||
from mcp_types import TextContent
|
||||
from mcp_types import TextResourceContents
|
||||
|
||||
|
||||
@@ -6,8 +7,9 @@ async def assert_server_contract(client: Client) -> None:
|
||||
resources = {str(resource.uri) for resource in await client.list_resources()}
|
||||
templates = {str(template.uri_template) for template in await client.list_resource_templates()}
|
||||
prompts = {prompt.name for prompt in await client.list_prompts()}
|
||||
tools = {tool.name for tool in await client.list_tools()}
|
||||
|
||||
assert await client.list_tools() == []
|
||||
assert tools == {"get_prompt", "list_prompts", "list_resources", "read_resource"}
|
||||
assert "skill://pytesting/SKILL.md" in resources
|
||||
assert "resource://docs/{path*}" in templates
|
||||
assert "skill://pytesting/{path*}" in templates
|
||||
@@ -20,3 +22,13 @@ async def assert_server_contract(client: Client) -> None:
|
||||
assert "# Pytesting" in skill_content[0].text
|
||||
assert isinstance(docs_content[0], TextResourceContents)
|
||||
assert '"format": "markdown"' in docs_content[0].text
|
||||
|
||||
listed = await client.call_tool("list_resources")
|
||||
listed_content = listed.content[0]
|
||||
assert isinstance(listed_content, TextContent)
|
||||
assert "skill://pytesting/SKILL.md" in listed_content.text
|
||||
|
||||
read = await client.call_tool("read_resource", {"uri": "skill://pytesting/SKILL.md"})
|
||||
read_content = read.content[0]
|
||||
assert isinstance(read_content, TextContent)
|
||||
assert "# Pytesting" in read_content.text
|
||||
|
||||
Reference in New Issue
Block a user