Skip to main content
Glama
test_tool_formatter.py1 kB
from mcp_code_mode.tool_formatter import ToolSchemaFormatter class FakeTool: def __init__(self): self.name = "read_file" self.description = "Read a text file" self.input_schema = { "properties": { "path": { "type": "string", "description": "Path to read", } }, "required": ["path"], } def test_format_for_llm_includes_usage_block(): formatter = ToolSchemaFormatter([FakeTool()]) doc = formatter.format_for_llm() assert "# Available MCP Tools (1 total)" in doc assert "## read_file" in doc assert "result = read_file(path: string)" in doc assert 'path="path_value"' in doc # Example generation def test_get_tool_names_returns_discovered_names(): tools = [FakeTool(), FakeTool()] tools[1].name = "write_file" formatter = ToolSchemaFormatter(tools) assert formatter.get_tool_names() == ["read_file", "write_file"]

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/draphonix/mcp-code-mode'

If you have feedback or need assistance with the MCP directory API, please join our Discord server