MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_tool_execution

Function test_tool_execution

tests/integration/test_echo_roundtrip.py:35–56  ·  view source on GitHub ↗

Verify a tool can be called and returns a result.

(tool_manager_sqlite)

Source from the content-addressed store, hash-verified

33@pytest.mark.integration
34@pytest.mark.asyncio
35async def test_tool_execution(tool_manager_sqlite):
36 """Verify a tool can be called and returns a result."""
37 tm = tool_manager_sqlite
38
39 # Find a tool to call (sqlite usually has list_tables or read_query)
40 tools = await tm.get_unique_tools()
41 tool_names = [t.name for t in tools]
42
43 # Try common sqlite tool names
44 target = None
45 for candidate in ("list_tables", "list-tables", "read_query", "read-query"):
46 if candidate in tool_names:
47 target = candidate
48 break
49
50 if target is None:
51 pytest.skip(f"No known sqlite tool found in: {tool_names[:10]}")
52
53 # Execute the tool
54 result = await tm.execute_tool(target, {})
55 assert result.success, f"Tool {target} failed: {result.error}"
56 assert result.result is not None
57
58
59@pytest.mark.integration

Callers

nothing calls this directly

Calls 2

get_unique_toolsMethod · 0.45
execute_toolMethod · 0.45

Tested by

no test coverage detected