Skip to main content
Glama

MetricDuck — Financial Analysis

Compare Companies / Peers

compare_companies
Read-only

Use this when the user asks how a company compares with its peers or named rivals: a side-by-side table of ~70 metrics (latest TTM, FY or Q), its rank on ROIC, operating margin and revenue growth, and whether it leads or trails on them; screen_companies finds companies by criteria, and get_metric_history covers one company's past.

Returns a side-by-side table covering valuation (P/E, P/B, EV/EBITDA, EV/Sales, FCF yield), profitability (gross/operating/net/EBITDA margins, ROE, ROA, ROIC), leverage & liquidity (cash, debt/equity, net debt/EBITDA, interest coverage, current ratio), efficiency (asset/inventory turnover, DSO, cash conversion cycle), and capital returns (dividend yield, dividend payout ratio, buyback yield, shareholder yield). Sector-inapplicable metrics are omitted (e.g. gross margin / FCF leverage for banks).

Pass 'metrics' to focus the table on specific metric_ids. Each company's row is dated: 'Data through' is its latest reported period, and the table prices multiples at the last close on/before that period end (period-end LOCF; peers' dates can differ by a quarter); an 'At latest close' block gives the shown ones at the latest close, on TTM figures. For a multiple AS OF another date, or a CUSTOM definition (e.g. lease-adjusted EV), assemble it from get_stock_price + get_metric_history.

peer_mode controls peer selection:

  • 'sector' (default): auto-selected from same sector + similar market cap

  • 'tags': auto-selected by business model similarity (tag Jaccard) — better for cross-sector comparisons

Override with custom_peers for specific matchups. The number of custom_peers is capped (up to 10 peers); exceeding it returns the limit and the count you asked for, so retry with that many.

Use Cases:

  • "Compare AAPL vs MSFT" -> compare_companies("AAPL", custom_peers="MSFT")

  • "How does NVDA stack up in its sector?" -> compare_companies("NVDA")

  • "Dividend payout ratio: KO vs KDP/PEP/KHC" -> compare_companies("KO", custom_peers="KDP,PEP,KHC", metrics="dividend_payout_ratio,dividend_yield")

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "ticker": "<ticker>"
    },
    "name": "compare_companies"
  }
}

Input Schema

NameRequiredDescriptionDefault
tickerYesPrimary company ticker symbol to compare (e.g., 'AAPL'). Must be exact.
metricsNoOptional comma-separated metric_ids to show instead of the default curated table (e.g. 'dividend_payout_ratio,dividend_yield,ev_ebitda,roa,interest_coverage'). Drawn from the ~70 curated fundamentals. A near-miss such as 'operating_margin' is read as 'oper_margin' and said so; any other unknown id is named in the response with its closest ids. Responses cap at ~20K chars — a subset here (or fewer custom_peers) keeps a large comparison whole.
peer_modeNoPeer selection method: 'sector' (same sector + similar market cap, default) or 'tags' (business model similarity — finds companies with overlapping classification tags). Use 'tags' for cross-sector business model comparisons, e.g. NVDA vs AMD/Broadcom instead of NVDA vs MSFT/GOOG.sector
period_typeNo'TTM' (default): trailing twelve months. 'FY': each company's latest reported fiscal year. 'Q': each company's latest reported fiscal quarter. Each company is at ITS OWN latest period (fiscal years end in different months, e.g. CRM January, ORCL May), and the 'YoY' rows compare it with the same period a year earlier ('Prior period' row). At 'Q' the ratios annualized from one quarter (P/E, EV multiples, ROE/ROA/ROIC, yields, turnover) are not shown. net_interest_income (banks) is served at FY and Q only. Example: compare_companies("JPM", custom_peers="BAC,WFC", period_type="Q", metrics="net_interest_income,net_income").TTM
custom_peersNoOptional comma-separated peer tickers (e.g., 'MSFT,GOOG,AMZN'). Auto-selected if omitted.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / period_type
      Added value: +{
      +  "default": "TTM",
      +  "description": "'TTM' (default): trailing twelve months. 'FY': each company's latest reported fiscal year. 'Q': each company's latest reported fiscal quarter. Each company is at ITS OWN latest period (fiscal years end in different months, e.g. CRM January, ORCL May), and the 'YoY' rows compare it with the same period a year earlier ('Prior period' row). At 'Q' the ratios annualized from one quarter (P/E, EV multiples, ROE/ROA/ROIC, yields, turnover) are not shown. net_interest_income (banks) is served at FY and Q only. Example: compare_companies(\"JPM\", custom_peers=\"BAC,WFC\", period_type=\"Q\", metrics=\"net_interest_income,net_income\").",
      +  "enum": [
      +    "TTM",
      +    "FY",
      +    "Q"
      +  ],
      +  "type": "string"
      +}
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the readOnly/openWorld annotations: sector-inapplicable metrics are omitted (with a bank example), rows are dated with period-end LOCF so peers' dates can differ by a quarter, and the custom_peers cap returns the limit plus the count requested so the agent can retry. That error-path disclosure is unusually useful for a read-only tool.

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 routing sentence and the alternative tools, and the metric-category inventory is scannable. Some of it duplicates the schema, though — the 'dividend_payout_ratio,dividend_yield' example and the peer_mode description appear in both places, and the parenthetical metric lists are long.

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?

There is no output schema, so the description carries the return-value burden and does so: it enumerates the table's metric families, explains the dated rows and the 'At latest close' block, and notes the ~20K char response cap that drives subsetting. Nothing an agent needs to call this correctly is missing.

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 real meaning the schema lacks, notably the custom_peers cap, the metric focus behavior, and the fact that each company sits at its own latest period so 'Q' suppresses annualized ratios. It mostly restates peer_mode and repeats the schema's metrics example, which keeps it off a 5.

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 and resource ('compare_companies': a side-by-side table of ~70 metrics with ROIC/operating-margin/revenue-growth ranks) and immediately distinguishes itself from screen_companies and get_metric_history. An agent can route to this tool 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?

Opens with the exact user phrasing that should select it ('how a company compares with its peers or named rivals'), names the alternatives for the cases it doesn't cover, and explains when to prefer peer_mode='tags' over 'sector'. It even routes the unsupported case (a multiple as of another date, or a custom definition like lease-adjusted EV) to get_stock_price + get_metric_history.

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