Skip to main content
Glama

simulate_bond

Read-onlyIdempotent

Simulates a hypothetical Tesouro Direto bond operation at a given trade date and rate, returning the full set of metrics for that operation: price (PU), quotation, Macaulay/modified duration, and optionally the cash-flow schedule (coupons or installments).

USE THIS for ANY question about a Tesouro Direto bond — price, quotation, duration, sale proceeds, payment schedule, etc. Single tool, all metrics. Bulk: up to 10 items per request (5 if any item sets includeSchedule).

Output is discriminated by productFamily ('prefixado' | 'ipca' | 'renda-educa' | 'selic'). The schedule field defaults to null to keep responses compact (a Renda+ schedule alone has 240 entries). It comes populated as [{ date, businessDays, flow, cashFlowBrl, presentValue, kind, number? }] (kind: 'coupon' | 'principal' | 'installment') — flow is the nominal cash flow before discounting (STN-style flow, not a currency amount); semantics depend on kind. cashFlowBrl is BRL per one bond unit (face 1000): flow/100 × settlement snapshot of 1000 / vnaProjected / vniProjected, truncated to centavos (T-2 floor) — not a forecast of BRL actually credited on each payment date for indexed families (VNA on IPCA+ with coupons, VNI on Renda+/Educa+; both move with IPCA accrual); discounted sum of cashFlowBrl may differ slightly from PU (T-6). Only when the caller passes includeSchedule: true AND the bond family supports a schedule (zero-coupon families like prefixado / ipca-mais / selic never have one). Whenever a field is null, a structured warning in meta.warnings[] with code and field explains why.

Every response also carries a calculation object (discriminated by kind: 'prefixado-zero' | 'prefixado-semestrais' | 'ipca' | 'renda-educa' | 'selic') with the intermediate values used by the engine — business days to maturity, truncated discount exponent, discount factor, VNA/VNI base + projected, IPCA monthly rate, and (when auto-fetched) automaticIpcaValidFrom. For IPCA-linked families the indexProjection also splits the two projection legs: monthsBeyondVnaBase / monthsCompounded / compoundedFactor (the whole-month forward compounding) versus exponent (the sub-month pro-rata). On Tesouro Selic the calculation carries vnaProjected (the VNA the price discounts, truncated to 6 decimals), selicTarget (the Copom target standing in for the fixings not yet published) and an indexProjection with lastFixing / base / projectedBusinessDays. Use it to audit a price against the official methodology without re-running it.

Tesouro Selic (LFT) is priced off its VNA rather than a fixed face of 1000: annualRate there is the SPREAD over the Selic (ágio/deságio), routinely near zero and often negative (e.g. '-0.0002'), never the Selic rate itself. Because the VNA closes on the last published fixing and is projected to settlement at the Copom target, the trade date matters on top of the settlement date — a D+0 sale projects nothing, a D+1 purchase projects one business day.

Inputs: tradeDate (YYYY-MM-DD) is the negotiation date — NOT the settlement date. side ('investorBuy' | 'investorSell', optional but recommended when direction is known): semantic intent of the operation. When provided, the engine derives the correct settlementConvention automatically — 'investorBuy' -> 'D+1'; 'investorSell' -> 'D+0' if tradeDate >= 2021-09-13 (same-day sell-back rule), else 'D+1'. Omit side when simulating for pure pricing purposes without a specific trade direction. settlementConvention ('D+0' | 'D+1', optional): advanced override — when omitted, the engine derives from side (or defaults to 'D+1' when both are omitted). If both side and settlementConvention are provided and conflict, the explicit settlementConvention is used and a NONSTANDARD_SETTLEMENT_FOR_SIDE warning is emitted. The response echoes side (when provided), settlementConvention (resolved), and settlementDate. includeSchedule (default false) opts in to coupon/installment detail. annualRate MUST be a decimal string (e.g. '0.1423' for 14.23%, never '14.23'). Bond identification: prefixado/IPCA+/Selic require maturityDate; Renda+/Educa+ require conversionYear OR maturityYear. Optional overrides: vnaBase+ipcaMonthlyRate for IPCA+ types, vniBase+ipcaMonthlyRate for Renda+/Educa+ (auto-fetched if omitted). ipcaMonthlyRate is the current-month ANBIMA projection used ONLY for the sub-month pro-rata — it does NOT compound whole months forward. For a future-dated valuation (settlement months/years ahead), pass ipcaForwardMonthlyRate (assumed monthly IPCA) to project the VNA/VNI base forward over the whole-month gap; it is ignored when vnaBase/vniBase is overridden. Note ipcaForwardMonthlyRate and annualRate are orthogonal assumptions: the forward rate is the inflation that grows the VNA/VNI base, while annualRate is the REAL yield (the '+X%' of IPCA+X%) that discounts it — for IPCA-linked types it does NOT include inflation. A future-dated valuation needs BOTH set to the future scenario; passing ipcaForwardMonthlyRate with today's annualRate models future inflation at today's real yield.

Warning catalog (meta.warnings[], each { code, field?, message }): NONSTANDARD_SETTLEMENT_FOR_SIDE (both side and settlementConvention were provided and the explicit convention differs from the standard for that side — explicit value was used); SYNTHESIZED_BOND (bond not in catalog, synthesized for historical simulation); SETTLEMENT_BEFORE_LAUNCH (settlement predates the bond's launch date); IPCA_STALE (auto IPCA projection is over 35 days old vs settlement); IPCA_PROJECTION_MISSING (historical settlement before the earliest bundled IPCA projection — engine falls back to ipcaMonthlyRate=0, using the VNA of the nearest past day-15 without pro-rata; pass an explicit ipcaMonthlyRate for better precision); IPCA_FORWARD_RATE_IGNORED (both a vnaBase/vniBase override and ipcaForwardMonthlyRate were supplied — the override is authoritative so the forward rate was ignored); IPCA_FORWARD_GAP_NOT_COMPOUNDED (settlement is N whole months beyond the last published VNA/VNI and no ipcaForwardMonthlyRate was supplied — the gap was NOT compounded onto the base, only the sub-month pro-rata; pass ipcaForwardMonthlyRate for a future-dated valuation, or refresh bundled VNA data if the settlement is actually near-term); SUSPICIOUS_RATE (annualRate > 1.0 — likely passed as percentage); CALENDAR_LAW_SWITCH (tradeDate predates Lei 14.759/2023; legacy calendar without Nov 20 holiday is in use); TRADE_DATE_NON_BUSINESS_DAY (tradeDate is a weekend, holiday, or market interruption — settlement was rolled forward to the next business day, so D+0 and D+1 may resolve to the same date); NOT_INCLUDED (field could exist but caller did not request it — set the matching include* flag, e.g. schedule on coupon/stream families); CASHFLOW_BRL_SETTLEMENT_VNA_SNAPSHOT (only when includeSchedule: true for bondType ipca-mais-com-juros-semestrais — each schedule[].cashFlowBrl uses the settlement VNA snapshot; see message); CASHFLOW_BRL_SETTLEMENT_VNI_SNAPSHOT (only when includeSchedule: true for bondType renda-mais or educa-mais — each schedule[].cashFlowBrl uses the settlement VNI snapshot; see message); NOT_AVAILABLE_FOR_OPERATION (the provided side is not among the bond's current availableFor sides in the catalog, e.g. investorBuy on a bond withdrawn from new offerings and now sell-only — the simulation still runs as a hypothetical scenario, it is not blocked).

All values are pre-tax (gross), based on hypothetical inputs — this is a simulation, NOT a real-time market quote nor an offer to trade. IR and IOF apply on actual operations. Each bulk row returns { input, ok: true, result } or { input, ok: false, error }.

Before calling, use catalog_list if you need to discover available bonds or disambiguate the user's reference.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYesList of pricing rows. Max 10 items (default), or max 5 when any row sets includeSchedule=true (schedule entries can be hundreds per row for Renda+/Educa+).

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. Changed1 schema field changed
    • changedInput schema / properties / items / items / properties / bondType / 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. Changed2 schema fields changed
    • addedInput schema / properties / items / items / properties / ipcaForwardMonthlyRate
      Added value: +{
      +  "description": "Assumed monthly IPCA (decimal) used to project the VNA/VNI base FORWARD over the whole months between the last published day-15 and the settlement month, before the sub-month pro-rata. Only for IPCA-linked types. Opt-in: omit for spot/near-term pricing (identical to today). Ignored when vnaBase/vniBase is overridden (the override is authoritative). Distinct from ipcaMonthlyRate — they may hold different values.",
      +  "pattern": "^-?\\d+(\\.\\d+)?$",
      +  "type": "string"
      +}
    • changedInput schema / properties / items / items / properties / ipcaMonthlyRate / description
      Previous value: -"Monthly IPCA rate as decimal. Only for IPCA-linked types — auto-fetched by settlement date if omitted."New value: +"Monthly IPCA rate as decimal. Only for IPCA-linked types — auto-fetched by settlement date if omitted. This is the current-month ANBIMA projection used ONLY for the sub-month pro-rata within the settlement month; it does NOT compound whole months forward. For a future-dated valuation, use ipcaForwardMonthlyRate."
  4. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, and the description adds substantial behavioral context beyond that: the simulation is hypothetical and not a market quote, schedule defaults to null for size, a structured warning catalog explains null fields, VNA/VNI projection semantics are detailed, and settlement-side derivation rules are fully disclosed. No contradiction with annotations exists.

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?

The description is long but justified for a complex multi-family bond simulator: warning codes, cash-flow semantics, and settlement conventions all need the space. It is front-loaded with the core use case and key outputs. Some repetition exists with the input schema (e.g., tradeDate vs settlementDate), which keeps a 5 out of reach.

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 this complexity, the description is exhaustive: inputs, output semantics, schedule structure, calculation object, warning catalog, edge cases, future-dated valuations, bulk envelope, and the disclaimer about hypothetical use. The output schema covers return structure, so the lack of an explicit truncated output listing is not a gap.

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

Parameters5/5

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

Schema coverage is 100%, so baseline is 3, but the description goes far beyond the schema: it distinguishes tradeDate from settlementDate, explains that annualRate must be a decimal string not a percentage, clarifies side-to-settlementConvention derivation and conflicts, separates ipcaMonthlyRate from ipcaForwardMonthlyRate, and explains bond identification requirements. This is rich, non-redundant guidance that materially improves correct invocation.

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 names a specific verb ('simulates'), resource ('Tesouro Direto bond operation'), and the full set of outputs (PU, quotation, durations, optional cash-flow schedule). It also frames itself as the single tool for any bond question, making its scope unmistakable and distinguishing it from the sibling data-lookup tools.

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

Usage Guidelines4/5

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

The description gives strong context: 'USE THIS for ANY question about a Tesouro Direto bond', explains bulk limits, and explicitly directs the agent to catalog_list for discovery/disambiguation. It does not, however, spell out when not to use this tool versus siblings like price_history_lookup or simulate_redemption, so there are no explicit exclusions or alternatives.

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