Skip to main content
Glama

price_history_ranking

Read-onlyIdempotent

Ranks every bond in the active Tesouro Direto catalog by where its latest published rate sits within its own history — in ONE call. Prefer this for questions like "which bonds have rates near their historical highs?", "how does today's rate compare with the past, across the catalog?", or any cross-bond comparison of rate levels. Do NOT loop price_history_series per paper for that.

For each catalog paper and each requested window it returns rate stats for one side: min/max, nearest-rank percentiles p10/p25/p50/p75/p90 (always actually published rates), last (most recent published rate on or before to) and lastPercentile (0-100: share of the window strictly below last — 92 means the current rate is above 92% of the period, i.e. near the top of its historical range).

Inputs (all optional):

  • windows: 1-3 of '30d' | '90d' | '1y' | '5y' | 'max', default ['1y']. Ranking is ordered by the FIRST window's lastPercentile (desc); extra windows add context (e.g. ['1y','max']).

  • side: 'investorBuy' (default — investor PURCHASE rate, STN's Taxa de Compra; the standard quoted rate) or 'investorSell' (sell-back). Only papers currently available for that side are ranked.

  • productId: filter to one family. Only the seven catalog families are rankable — 'igpm-mais-com-juros-semestrais' has history but no active catalog entries; for it use price_history_series. On 'selic' the percentiles are coarse: the published rate is a spread over the Selic, near zero and rounded to two decimals of a percent, so a window holds few distinct values.

  • to: anchor date YYYY-MM-DD (default today UTC) — set a past date for "how did the ranking look then?".

Output: ranking[] with productId, maturityDate, year (label year — CONVERSION year for renda-mais/educa-mais) and per-window stats; meta.missing lists catalog papers with no data in any window (e.g. just launched).

Caveats: this is a statistical description of published rates, NOT investment advice, a return forecast, or a recommendation — never present the ranking as "best bonds to buy". lastPercentile compares each paper against ITS OWN history only; a high percentile means the rate is high relative to that paper's past, nothing more. Comparing entries across families is meaningful only in that relative sense (a prefixado percentile reflects nominal rates; an ipca-mais percentile reflects real rates).

Rates are decimal fraction strings (same as price_history_series, simulate_bond, live_quotes_lookup).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNoAnchor date YYYY-MM-DD for all windows (inclusive end). Default: today (UTC). Set a past date to ask 'how did the ranking look on that day?'.
sideNoWhich rate to rank: 'investorBuy' (default — the rate at which the investor buys from the Treasury, the standard quoted rate) or 'investorSell' (sell-back rate).
windowsNoLookback windows ending at `to` (1-3, default ['1y']): '30d' | '90d' | '1y' | '5y' | 'max' (full history). The ranking is ordered by the FIRST window; extra windows add context (e.g. ['1y','max']).
productIdNoOptional filter to a single product family. Omit to rank the whole active catalog. Only catalog families are rankable (no 'igpm-mais-com-juros-semestrais' — it has history but no active catalog entries).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. Changed2 schema fields changed
    • changedInput schema / properties / productId / description
      Previous value: -"Optional filter to a single product family. Omit to rank the whole active catalog. Only catalog families are rankable (no 'selic' / 'igpm-mais-com-juros-semestrais' — those have history but no active catalog entries)."New value: +"Optional filter to a single product family. Omit to rank the whole active catalog. Only catalog families are rankable (no 'igpm-mais-com-juros-semestrais' — it has history but no active catalog entries)."
    • changedInput schema / properties / productId / enum
      Previous value: -[
      -  "prefixado",
      -  "prefixado-com-juros-semestrais",
      -  "ipca-mais",
      -  "ipca-mais-com-juros-semestrais",
      -  "renda-mais",
      -  "educa-mais"
      -]New value: +[
      +  "prefixado",
      +  "prefixado-com-juros-semestrais",
      +  "ipca-mais",
      +  "ipca-mais-com-juros-semestrais",
      +  "renda-mais",
      +  "educa-mais",
      +  "selic"
      +]
  3. Added

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already mark readOnlyHint=true, idempotentHint=true, and destructiveHint=false, but the description adds substantial behavioral context beyond that: exact percentile definitions, the meaning of lastPercentile (e.g. '92 means the current rate is above 92% of the period'), the 'not investment advice' caveat, the per-paper self-comparison semantics, and the decimal-fraction-string format. This gives the agent a full picture of what the operation actually returns and how to interpret it.

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

Conciseness5/5

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

Although lengthy, the description is well structured into Inputs, Output, and Caveats, with front-loaded purpose and usage guidance. Each section earns its place: definitions, parameter semantics, output shape, and caveats are all needed for correct use, and nothing is repetitive or 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?

For a tool with four optional parameters, a rich output schema, and multiple caveats, the description is complete: it covers all parameters, describes the ranking[] output and meta.missing, explains edge cases like newly launched papers, and clarifies cross-family comparability. An agent has everything needed to select and call this tool correctly.

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?

The input schema already covers all parameters at 100%, but the description adds meaning beyond the schema: it explains that ranking order is driven by the first window, that only papers available for the selected side are ranked, that only seven catalog families are rankable, and that 'selic' percentiles are coarse due to rounding. These enrich the schema's parameter descriptions meaningfully.

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?

The description opens with a specific verb and resource: 'Ranks every bond in the active Tesouro Direto catalog by where its latest published rate sits within its own history.' It names concrete example questions and explicitly contrasts itself with price_history_series, so an agent can distinguish this tool from its siblings immediately.

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?

The description gives explicit when-to-use guidance: 'Prefer this for questions like...' and 'any cross-bond comparison of rate levels.' It also states a clear exclusion — 'Do NOT loop price_history_series per paper for that' — and even directs a specific product family to a different tool, making the routing unambiguous.

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.

Resources