Direct tool calling
The call_tool method lets you call a specific MCP tool on a Connector directly, without starting a conversation or involving the model.
This is useful when you:
- Already know which tool to call and what arguments to pass
- Want the raw tool output for downstream processing
- Are building pipelines that chain tool calls programmatically
- Want to debug or verify Connector tools before using them in conversations
For scenarios where the model picks which tools to call, use Connectors in conversations instead.
If a Connector requires authentication, you must complete the auth flow before calling its tools.
Call a tool directly
To call a tool, pass the Connector name (or UUID), the tool name, and the arguments the tool expects.
import asyncio
from mistralai.client import Mistral
client = Mistral(api_key="your-api-key")
async def main() -> None:
result = await client.beta.connectors.call_tool_async(
connector_id_or_name="my_deepwiki",
tool_name="read_wiki_structure",
arguments={"repoName": "sqlite/sqlite"},
)
# result.content is a list of content blocks (TextContent, ImageContent, etc.)
for item in result.content:
if hasattr(item, "text"):
print(item.text)
asyncio.run(main())The response content array contains typed content blocks (text, image, audio, or resource) returned by the MCP server.
Tool names must match exactly: use list tools to check what a Connector exposes.
Chain multiple tool calls
You can call multiple tools in sequence to build a pipeline without involving the model at each step.
import asyncio
from mistralai.client import Mistral
client = Mistral(api_key="your-api-key")
async def main() -> None:
# First call: get the repository structure
structure = await client.beta.connectors.call_tool_async(
connector_id_or_name="my_deepwiki",
tool_name="read_wiki_structure",
arguments={"repoName": "sqlite/sqlite"},
)
for item in structure.content:
if hasattr(item, "text"):
print("Structure:", item.text[:300])
# Second call: ask a question about the repo
answer = await client.beta.connectors.call_tool_async(
connector_id_or_name="my_deepwiki",
tool_name="ask_question",
arguments={
"repoName": "sqlite/sqlite",
"question": "What is the purpose of the VDBE?",
},
)
for item in answer.content:
if hasattr(item, "text"):
print("Answer:", item.text[:300])
asyncio.run(main())