Skip to content

MCP Tool Calls

Workflow scripts can call any external MCP server configured in the project's MCP integration settings.

mcp(server_name) → _MCPClient

Returns an MCP client for the named server.

python
result = mcp("exa").call("web_search_exa", {"query": "Python 3.13"})
print(result["content"][0]["text"])

Raises: KeyError if the server is not configured; ValueError if no URL (stdio servers are unsupported).


.call(tool_name, arguments, timeout) → dict

Synchronously call a tool.

python
result = mcp("exa").call("web_search_exa", {"query": "MCP 2025"}, timeout=30)
for item in result["content"]:
    if item["type"] == "text":
        print(item["text"])

.list_tools() → list

List available tools on the server.


Async: .acall() / .alist_tools()

Use inside async def run with asyncio.gather for concurrent calls:

python
async def run(params: dict, reporter) -> None:
    import asyncio
    r1, r2 = await asyncio.gather(
        mcp("exa").acall("web_search_exa", {"query": "Python 3.13"}),
        mcp("context7").acall("resolve-library-id",
                              {"query": "fastapi", "libraryName": "fastapi"}),
    )

mcp_call() shorthand

python
result = mcp_call("exa", "web_search_exa", {"query": "..."})

async_mcp_call() shorthand

python
result = await async_mcp_call("exa", "web_search_exa", {"query": "..."})

Built with VitePress