AI agents in action with MCP tools
On this page
An AI agent completes work by calling tools in a loop. An MCP tool is a named function with a typed input schema that an agent invokes through the Model Context Protocol. The agent sends arguments, the tool runs, and the agent reads the structured result before it chooses the next step.
What an AI agent does with a tool
An AI agent is a language model that runs in a loop. It reads a goal, picks an action, observes the result, and picks the next action. A tool gives the agent a way to act outside its own context. Without tools, the model can only produce text.
The Model Context Protocol standardizes how that access works. A server publishes its tools with names, descriptions, and input schemas. The client, usually the agent runtime, lists those tools and sends the chosen calls to the server. The model does not need custom glue code for each service it touches.
This split matters for developers. The model decides what to do. The server decides how the work runs. Each side stays easy to test on its own.
The tool call loop, step by step
Every agent run follows the same basic cycle. The cycle repeats until the goal is met or a limit stops it.
- The client lists the tools the server exposes.
- The model selects one tool and fills its arguments as JSON.
- The server runs the request and returns a structured result.
- The model reads the result and decides whether to stop or call again.
Each step adds text to the conversation. Long loops grow the context fast. Keep tool outputs short and specific, and return only the fields the model needs for its next decision.
Descriptions matter as much as code. A tool with a precise name and a clear schema gets picked correctly more often. A vague description leads the model to call the wrong tool or to guess arguments.
Three agent workflows that use tools
Developers build agents for many jobs. Three patterns cover a large share of early projects.
- Research summaries. The agent searches sources, opens the most relevant pages, and writes a brief with cited links.
- Support ticket triage. The agent reads an incoming ticket, looks up the customer record, and assigns a priority and queue.
- Data enrichment. The agent takes a list of company domains, calls lookup tools for each one, and writes the results to a table.
Each workflow needs a different mix of tools. Start with one workflow and a small set of tools. Add more tools only when a real task fails without them.
Connecting an agent to a gateway
A gateway sits between the agent and many upstream APIs. The agent connects to the gateway once. The gateway exposes each upstream capability as an MCP tool, so the agent sees one consistent interface across services.
Use the catalog to find the tool that fits the task before you write any integration code. The catalog lists each tool with its description and schema. Browse the tool directory to compare options for your workflow.
Point your MCP client at the gateway endpoint and list the tools. Then run one narrow task. A successful single call proves the connection before you expand the loop.
Payment and access for paid tools
Some tools charge per call. Per-call prices on the catalog fall between 0 and 29.99 USD, depending on the tool. Check the price in the tool's listing before the agent enters a costly loop.
Agents that pay for calls need a machine-readable payment flow. The x402 protocol uses the HTTP 402 status code to signal that payment is required. The client then sends a payment, usually in USDC, and retries the request. A human does not need to approve each call.
Set a budget in the agent runtime. A budget caps the total spend for one run. It stops a loop that retries a paid call again and again.
Failure modes to plan for
Agents fail in predictable ways. Plan for three of them before you ship.
- Timeouts. A slow upstream service stalls the loop. Set a per-call timeout and treat a timeout as a result the model can read.
- Malformed arguments. The model sends a field the schema does not allow. Validate arguments on the server and return a clear error message.
- Unbounded loops. The model keeps calling tools without making progress. Cap the number of steps for each run.
Log every tool call with its arguments, result, and latency. Logs show where the agent wastes steps. They also show which tool descriptions confuse the model.
A short checklist before you ship an agent
Run this checklist before you give an agent access to production systems.
- Cap the number of steps and the total spend for each run.
- Log every tool call with arguments, results, and errors.
- Issue each agent a key that reaches only the tools its workflow needs.
Test the agent on recorded inputs first. Replay the same tasks after each change to the prompt or the tool set. Regressions show up fast this way.
Live pricing — developer
Data source: live tool catalog snapshot, fetched 2026-11-25.
Chart data as a table
| Tool | Price per call | Cache-hit price |
|---|---|---|
| Usage Time Series | $0.0 | $0.0 |
| Per-Tool Usage Breakdown | $0.0 | $0.0 |
| Usage Summary | $0.0 | $0.0 |
| Discover Tools | $0.0 | $0.0 |
| Batch Tool Calls | $0.0 | $0.0 |
| Tool Quality Metrics | $0.0 | $0.0 |
| Tool Quality Rankings | $0.0 | $0.0 |
| List Programming Languages | $0.001 | $0.0001 |
| Check CVE ID Reservation Status | $0.001 | $0.0001 |
| Security Advisories (deps.dev) | $0.001 | $0.0001 |
| Dependency Tree (deps.dev) | $0.001 | $0.0001 |
| Package Info (deps.dev) | $0.001 | $0.0001 |
| Tool | Provider | Price/call | Cache-hit |
|---|---|---|---|
| Usage Time Series | account | $0 | $0 |
| Per-Tool Usage Breakdown | account | $0 | $0 |
| Usage Summary | account | $0 | $0 |
| Discover Tools | apibase | $0 | $0 |
| Batch Tool Calls | platform | $0 | $0 |
| Tool Quality Metrics | platform | $0 | $0 |
| Tool Quality Rankings | platform | $0 | $0 |
| List Programming Languages | judge0 | $0.001 | $0.0001 |
| Check CVE ID Reservation Status | cve-mitre | $0.001 | $0.0001 |
| Security Advisories (deps.dev) | depsdev | $0.001 | $0.0001 |
| Dependency Tree (deps.dev) | depsdev | $0.001 | $0.0001 |
| Package Info (deps.dev) | depsdev | $0.001 | $0.0001 |
Connect via MCP
Data source: gateway design, no measured values.
$ curl -X POST https://apibase.pro/api/v1/tools/account.timeseries/call \
-H "Content-Type: application/json" -d '{"params": {}}'FAQ
What is an AI agent in the context of MCP?
An AI agent is a language model that runs a loop of reasoning and actions. In the Model Context Protocol, the agent discovers tools from a server, calls them with JSON arguments, and reads the structured results. The protocol gives every tool the same discovery and calling pattern.
Does an agent need an SDK to call MCP tools?
No. An agent runtime with MCP client support can list and call tools directly. An SDK speeds up setup and handles transport details. A command line client works for quick tests before you write application code.
How do I stop an agent from running up costs?
Set a step limit and a spend budget for each run. Check the per-call price in the tool listing before you enable a paid tool. Log every call so you can see which tools drive the cost.
Can an agent pay for a tool on its own?
An agent can pay when the tool supports the x402 flow and the agent holds a funded USDC wallet. The agent receives an HTTP 402 response, sends payment, and retries the request. Keep the wallet balance small and set a budget in the runtime.
Which workflow should I build first?
Start with a workflow that has one clear input and one clear output. Give it a small number of tools. Research summaries and ticket triage work well for first builds. Add a tool only when a real task fails without it.
Recommended next step
- STEP 1/2 Connect your MCP client
- STEP 2/2 Browse the full catalog
Related guides
- which of the following best describes what makes an ai system an agent rather than a standard llm chatbot
- best free ai agents
- coinmarketcap api
- agentic commerce for merchants
Written with AI assistance from APIbase's published documentation and public data; checked automatically against them. Corrections: https://apibase.pro/
Published: 2026-11-25Source: live apibase.pro catalog snapshot