MCP-backed single-turn tool-use agent loop
Build an agent as a conversation loop that uses an MCP client to (1) connect to one or more MCP servers, (2) discover and register tools in an LLM-compatible tool schema, (3) stream a single LLM turn with tool definitions, and (4) execute any tool calls requested by the model by routing them to the corresponding MCP server, then feed tool results back into the conversation until an explicit exit condition is reached.
Discovered 2026-11-10 · Sources checked 2026-11-10
Why it matters
The approach standardizes tool access via MCP, so agents can plug in new capabilities by connecting to MCP servers rather than writing bespoke integrations for each tool.
What changed
Instead of hard-coding per-tool integrations, the agent delegates tool discovery and execution to an MCP client that manages connections to MCP servers and exposes discovered tools to the LLM for function calling.
Where it helps
- Web browsing workflows using a Playwright MCP server
- Local file/desktop access via a file system MCP server
- Task automation by exposing custom capabilities through stdio MCP servers
- Using remote tool servers over http or sse transport
- Image generation or other multimodal actions via an MCP-enabled Gradio Space
Evidence & reproduction
Reproduction not evaluated. A linked paper or repository does not establish independent reproduction.
Limitations & open questions
The agent behavior depends on the connected MCP servers exposing correct tool schemas and on the model producing tool calls that match those schemas; if tool discovery or routing fails (e.g., no MCP session for a requested tool), the agent must return an error message as the tool output.
Sources
- Tiny Agents in Python: a MCP-powered agent in ~70 lines of code ↗
Hugging Face · primary · Published 2025-05-23 · Checked 2026-11-10
