Skip to main content
Glama

fetch_data

Read-onlyIdempotent

One-step fetch: find the best Sugra endpoint for the query and call it.

Combines search_endpoints + call_endpoint into a single round trip. Use this when you want data without manually picking an operation_id. The full search_endpoints + describe_endpoint + call_endpoint dance is still available when you need explicit control, but for most natural-language queries this tool is enough.

Behavior:

  1. Search the bundled catalog for the query. Top match wins.

  2. If the matched endpoint has required parameters and they are all provided in params, call it and return the response.

  3. If required parameters are missing, return the candidate endpoints and the missing-params list so the LLM can retry with the correct params dict on the next call.

  4. If the query names a country and the match takes a country or countries param that params leaves unset, return needs_params for it with query_countries (ISO2) instead of running the match without that filter.

Examples:

  • fetch_data("US CPI inflation", params={"series_id": "CPIAUCSL"}) runs fred_series_series_id (/api/v1/fred/series/CPIAUCSL) and returns observations.

  • fetch_data("Bitcoin price") runs onchain_bitcoin_price, which takes no params.

  • fetch_data("Latest financial news") runs news_latest, which has no required params. Only the top match runs, and a param it does not declare returns error unknown_parameters. For one coin's price, name the operation: call_endpoint("crypto_coin_id_price", params={"coin_id": "bitcoin"}).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNoJSON body for an auto-selected POST operation; the tool returns the request_body_schema to fill when the match needs one. Pass a JSON object or a JSON array as that schema's top-level type dictates.
limitNoBounds ONLY the records list: the data list, a bare top-level array, or the list inside an object data when exactly one of these keys holds a list: data, entries, events, history, items, observations, points, records, results, rows, series, timeseries (for example data.items). When data has no such single list but every one of its values is an object holding exactly one list named observations, limit bounds each data.<key>.observations list on its own (records_path data.*.observations); fields there still names keys of data. Otherwise, no such list, or several, means the limit does not apply. Keys beside the list such as total and count are not rewritten, and lists nested inside records are never truncated. limit keeps the newest N records when every record carries one date or period key in one format and the list runs one way by it, else the first N, and meta.shaped reports limit_applied, records_path and, for a bounded records list, order (asc, desc or unknown) and kept_end (newest or first), as maps by name for sibling sub-series.
queryYesNatural-language request for data (examples: 'US CPI', 'Bitcoin price', 'latest news'). The tool picks the top catalog match and calls it. If required params are missing it returns needs_params instead of guessing.
fieldsNoOptional projection of keys to keep on each record of the records list: the data list, a bare top-level array, or the list inside an object data when exactly one of these keys holds a list: data, entries, events, history, items, observations, points, records, results, rows, series, timeseries (for example data.items). Keys beside that list such as total and count stay. If a field names a key of data itself, or of a payload without data, that object is projected instead; an object data without such a list is otherwise kept whole. Dotted paths (geo.city) walk nested objects. If no field matches, nothing is removed. meta.shaped reports fields_applied, fields_unmatched and records_path. Omit to keep every key.
paramsNoParameters for the auto-selected endpoint. If omitted and the best-match endpoint has required parameters, the tool returns that endpoint's required_parameters and examples so you can retry with them filled in.
include_rawNoIf true, attach the original unshaped payload under raw when it fits the size cap; otherwise meta.raw_omitted explains why. Default false.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / limit / description
      Previous value: -"Bounds ONLY the records list: the data list, a bare top-level array, or the list inside an object data when exactly one of these keys holds a list: data, entries, events, history, items, observations, points, records, results, rows, series, timeseries (for example data.items). No such list, or several, means the limit does not apply. Keys beside the list such as total and count are not rewritten, and lists nested inside records are never truncated. meta.shaped reports limit_applied and records_path."New value: +"Bounds ONLY the records list: the data list, a bare top-level array, or the list inside an object data when exactly one of these keys holds a list: data, entries, events, history, items, observations, points, records, results, rows, series, timeseries (for example data.items). When data has no such single list but every one of its values is an object holding exactly one list named observations, limit bounds each data.<key>.observations list on its own (records_path data.*.observations); fields there still names keys of data. Otherwise, no such list, or several, means the limit does not apply. Keys beside the list such as total and count are not rewritten, and lists nested inside records are never truncated. limit keeps the newest N records when every record carries one date or period key in one format and the list runs one way by it, else the first N, and meta.shaped reports limit_applied, records_path and, for a bounded records list, order (asc, desc or unknown) and kept_end (newest or first), as maps by name for sibling sub-series."
  2. Changed2 schema fields changed
    • changedInput schema / properties / fields / description
      Previous value: -"Optional projection of keys to keep on each record. Dotted paths (geo.city) walk nested objects. meta.shaped reports fields_applied and fields_unmatched. Omit to keep every key."New value: +"Optional projection of keys to keep on each record of the records list: the data list, a bare top-level array, or the list inside an object data when exactly one of these keys holds a list: data, entries, events, history, items, observations, points, records, results, rows, series, timeseries (for example data.items). Keys beside that list such as total and count stay. If a field names a key of data itself, or of a payload without data, that object is projected instead; an object data without such a list is otherwise kept whole. Dotted paths (geo.city) walk nested objects. If no field matches, nothing is removed. meta.shaped reports fields_applied, fields_unmatched and records_path. Omit to keep every key."
    • changedInput schema / properties / limit / description
      Previous value: -"Bounds ONLY the top-level list: the envelope data list (or a bare top-level array). Nested lists inside records are never truncated; meta.shaped reports whether the limit applied."New value: +"Bounds ONLY the records list: the data list, a bare top-level array, or the list inside an object data when exactly one of these keys holds a list: data, entries, events, history, items, observations, points, records, results, rows, series, timeseries (for example data.items). No such list, or several, means the limit does not apply. Keys beside the list such as total and count are not rewritten, and lists nested inside records are never truncated. meta.shaped reports limit_applied and records_path."
  3. Changed1 schema field changed
    • changedInput schema / properties / body / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "items": {},
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  {
      +    "items": {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  4. Changed3 schema fields changed
    • addedInput schema / properties / fields / description
      Added value: +"Optional projection of keys to keep on each record. Dotted paths (geo.city) walk nested objects. meta.shaped reports fields_applied and fields_unmatched. Omit to keep every key."
    • addedInput schema / properties / include_raw / description
      Added value: +"If true, attach the original unshaped payload under raw when it fits the size cap; otherwise meta.raw_omitted explains why. Default false."
    • addedInput schema / properties / query / description
      Added value: +"Natural-language request for data (examples: 'US CPI', 'Bitcoin price', 'latest news'). The tool picks the top catalog match and calls it. If required params are missing it returns needs_params instead of guessing."
  5. Changed1 schema field changed
    • addedInput schema / properties / limit / description
      Added value: +"Bounds ONLY the top-level list: the envelope data list (or a bare top-level array). Nested lists inside records are never truncated; meta.shaped reports whether the limit applied."
  6. Changed2 schema fields changed
    • changedInput schema / properties / body / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  {
      +    "items": {},
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / body / description
      Previous value: -"JSON body for an auto-selected POST operation; the tool returns the request_body_schema to fill when the match needs one."New value: +"JSON body for an auto-selected POST operation; the tool returns the request_body_schema to fill when the match needs one. Pass a JSON object or a JSON array as that schema's top-level type dictates."
  7. Changed2 schema fields changed
    • addedInput schema / properties / body / description
      Added value: +"JSON body for an auto-selected POST operation; the tool returns the request_body_schema to fill when the match needs one."
    • addedInput schema / properties / params / description
      Added value: +"Parameters for the auto-selected endpoint. If omitted and the best-match endpoint has required parameters, the tool returns that endpoint's required_parameters and examples so you can retry with them filled in."
  8. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover the safety profile (readOnlyHint, idempotentHint, openWorldHint, destructiveHint=false), yet the description adds substantial behavior beyond them: top-match-wins selection, the needs_params retry contract, the unknown_parameters error, the country-param auto-injection rule, and the fact that only the top match runs. This is genuinely useful operational detail not derivable from the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose and alternative routing, then structured as numbered Behavior steps and Examples. It is longer than strictly necessary (three examples plus a trailing counter-example), but every section is load-bearing rather than filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present and full annotation coverage, the description need not explain return values; instead it supplies exactly the missing pieces — selection behavior, error/retry contracts, and alternative routing. An agent has everything needed to call this correctly on the first try.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description still adds meaning by explaining the retry flow for `params` (returns required_parameters and examples), the `query` natural-language contract, and the unknown_parameters failure mode. It does not restate the schema's extensive limit/fields semantics, which the schema already carries.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('fetch data') and immediately distinguishes itself from siblings: it 'Combines search_endpoints + call_endpoint into a single round trip.' The agent can tell it apart from search_endpoints, describe_endpoint, and call_endpoint without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when-to-use ('when you want data without manually picking an operation_id'), when the alternative is warranted ('the full search_endpoints + describe_endpoint + call_endpoint dance is still available when you need explicit control'), and a concrete fallback for a specific case ('For one coin's price, name the operation: call_endpoint(...)'). Nothing is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.