MCP / LangChain

Using this with LangChain

MCP tool adapter, or a thin wrapper over the REST API.

Setup

  1. Create a key on the free tier.
  2. Load the MCP tools through the framework adapter.
  3. Bind them to your agent alongside your other tools.
  4. Set a per-run request budget so a retry loop cannot exhaust your quota.

Budget from reformulations, not from users

Framework agents reformulate aggressively when a first result looks unsatisfying, so one user question routinely becomes three to five requests. This is the single biggest cause of surprise cost on this integration, and it is invisible in testing because you naturally test one query at a time and watch it succeed. Estimate from expected reformulations per question, and set a per-run request budget so a loop that fails to converge cannot consume a month of quota in an evening.

Order and describe your tools deliberately

Given both an article search tool and a story grouping tool with similar descriptions, an agent will usually take the first plausible one. If that is article search, it will fill its own context with syndicated duplicates and then reason over them. Put story grouping first and describe it as the default for event questions, reserving article search explicitly for coverage analysis. This costs one line and is the difference between a working integration and one that is quietly wasting most of its context window.

Retries interact badly with rate limits

The default retry behaviour treats a rate-limit response like any other transient failure and retries promptly, turning one throttled call into several and extending the throttle. Configure exponential backoff explicitly and treat rate-limit responses as a distinct case from network errors. This is standard advice for any API, but it bites harder here because the agent loop can be several layers away from where you configured the client.

Notes and the usual pitfall

Watch for: The default retry behaviour treats a rate-limit response as a transient error and retries immediately, which turns one throttled call into several. Configure backoff explicitly.