AI agents in action with MCP tools

developer2026-11-25

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

Price per call, developer tools Horizontal bar chart of the price per call and the cache-hit price, in US dollars, for 12 developer tools. The same values are in the table below the chart. Price per call Cache-hit price $0.0 $0.0005 $0.001 Usage Time SeriesUsage Time Series $0.0 $0.0 Per-Tool Usage BreakdownPer-Tool Usage Breakdown $0.0 $0.0 Usage SummaryUsage Summary $0.0 $0.0 Discover ToolsDiscover Tools $0.0 $0.0 Batch Tool CallsBatch Tool Calls $0.0 $0.0 Tool Quality MetricsTool Quality Metrics $0.0 $0.0 Tool Quality RankingsTool Quality Rankings $0.0 $0.0 List Programming LanguagesList Programming Languages $0.001 $0.0001 Check CVE ID Reservation Stat…Check CVE ID Reservation Status $0.001 $0.0001 Security Advisories (deps.dev)Security Advisories (deps.dev) $0.001 $0.0001 Dependency Tree (deps.dev)Dependency Tree (deps.dev) $0.001 $0.0001 Package Info (deps.dev)Package Info (deps.dev) $0.001 $0.0001 US dollars per call
Price per call for developer tools, cheapest first.

Data source: live tool catalog snapshot, fetched 2026-11-25.

Chart data as a table
ToolPrice per callCache-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
ToolProviderPrice/callCache-hit
Usage Time Seriesaccount$0$0
Per-Tool Usage Breakdownaccount$0$0
Usage Summaryaccount$0$0
Discover Toolsapibase$0$0
Batch Tool Callsplatform$0$0
Tool Quality Metricsplatform$0$0
Tool Quality Rankingsplatform$0$0
List Programming Languagesjudge0$0.001$0.0001
Check CVE ID Reservation Statuscve-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

How a tool call worksAn AI agent sends a tool call to the APIbase gateway. The gateway checks payment, calls the provider API, and returns the JSON result to the agent.Your agentAPIbase gatewayProvider API1. tool call2. paid call3. JSON result flows back to the agent
Diagram: the path of one tool call.

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.

  1. STEP 1/2 Connect your MCP client
  2. STEP 2/2 Browse the full catalog

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