49b9bb6724
Deploy Docs / deploy-docs (push) Failing after 1s
Conformance Tests / client-conformance (push) Failing after 3s
Conformance Tests / server-conformance (push) Failing after 1s
GitHub Actions Security Analysis / zizmor (push) Failing after 1s
CI / checks (push) Failing after 59m20s
CI / all-green (push) Has been cancelled
31 lines
925 B
Python
31 lines
925 B
Python
"""Test that parameter descriptions are properly exposed through list_tools"""
|
|
|
|
import pytest
|
|
from pydantic import Field
|
|
|
|
from mcp.server.mcpserver import MCPServer
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_parameter_descriptions():
|
|
mcp = MCPServer("Test Server")
|
|
|
|
@mcp.tool()
|
|
def greet(
|
|
name: str = Field(description="The name to greet"),
|
|
title: str = Field(description="Optional title", default=""),
|
|
) -> str: # pragma: no cover
|
|
"""A greeting tool"""
|
|
return f"Hello {title} {name}"
|
|
|
|
tools = await mcp.list_tools()
|
|
assert len(tools) == 1
|
|
tool = tools[0]
|
|
|
|
# Check that parameter descriptions are present in the schema
|
|
properties = tool.input_schema["properties"]
|
|
assert "name" in properties
|
|
assert properties["name"]["description"] == "The name to greet"
|
|
assert "title" in properties
|
|
assert properties["title"]["description"] == "Optional title"
|