Skip to main content
Glama
test_mcp_tool_call.py815 B
import json from unittest.mock import patch from server.mcp_server import handle_tool_call def test_mcp_tool_call_set_parameter(capsys): """Test that a tool call is executed and produces correct toolResult.""" # Patch the TOOL_FUNCTIONS entry *inside mcp_server* with patch("server.mcp_server.TOOL_FUNCTIONS", {"setParameter": lambda **kwargs: {"ok": True}}): msg = { "type": "toolCall", "tool": "setParameter", "arguments": {"param": "cutoff", "value": 0.5} } handle_tool_call(msg) # Check printed toolResult stdout = capsys.readouterr().out result = json.loads(stdout) assert result["type"] == "toolResult" assert result["tool"] == "setParameter" assert result["result"] == {"ok": True}

Latest Blog Posts

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/TYLERSFOSTER/MCPSynthController'

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