Skip to main content
Glama

Summarize symbol for context

get_context_for_symbol
Read-onlyIdempotent

Summarize a symbol's signature, effect row, doc comment, callers, and callees into a token-budgeted prompt, omitting sections that don't fit.

Instructions

Summarize one symbol for an LLM prompt within an approximate token budget: signature, effect row, doc comment, callers, and callees, added in that order while they fit. Use it as the default way to bring a symbol into context; use lookup_definition for just the location, explain_effect_row for effect explanations, and render_ir_fragment for the full body. Returns kind, the budget applied, summary (prompt-ready text), approx_tokens (its estimated cost at ~4 characters per token), and omitted (the sections that did not fit). The signature is always present, truncated when the budget is smaller than it. An unknown name is not_found with the available names in error.data.available. Read-only: compiles the file's directory in memory (cached until a sibling changes) and writes or executes nothing. Failures are isError results with a stable error.code: file_not_found, read_error, invalid_params, and, for every tool but check_file, parse_error or check_error carrying coded diagnostics in error.data.diagnostics (the shape check_file returns).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to a .hird source file, absolute or relative to the server's working directory. Every .hird file in its directory is compiled with it as one program, so imported names resolve; answers may name a sibling file.
nameYesThe symbol's name, as the file's source would write it: a local definition, a member imported with `use Mod.{name}`, or `Qualifier.name` through `use Mod`.
budgetNoApproximate token budget for the summary, at ~4 characters per token; optional, 400 when omitted. A section that does not fit is dropped whole and named in `omitted`; only the signature is truncated.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYes
kindYes
budgetYes
symbolYes
omittedYes
summaryYes
approx_tokensYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.4.0
    • addedInput schema / properties / budget / default
      Added value: +400
    • changedInput schema / properties / budget / description
      Previous value: -"Approximate token budget for the summary, at ~4 characters per token (default 400). A section that does not fit is dropped whole and named in `omitted`; only the signature is truncated."New value: +"Approximate token budget for the summary, at ~4 characters per token; optional, 400 when omitted. A section that does not fit is dropped whole and named in `omitted`; only the signature is truncated."
    • changedInput schema / required
      Previous value: -[
      -  "budget",
      -  "file",
      -  "name"
      -]New value: +[
      +  "file",
      +  "name"
      +]
  2. Changed4 schema fields changed
    • changedInput schema / properties / budget / description
      Previous value: -"Approximate token budget for the summary (default 400)."New value: +"Approximate token budget for the summary, at ~4 characters per token (default 400). A section that does not fit is dropped whole and named in `omitted`; only the signature is truncated."
    • changedInput schema / properties / file / description
      Previous value: -"Path to a .hird source file. Its directory's .hird files are compiled together as one program, so imported names resolve."New value: +"Path to a .hird source file, absolute or relative to the server's working directory. Every .hird file in its directory is compiled with it as one program, so imported names resolve; answers may name a sibling file."
    • changedInput schema / required
      Previous value: -[
      -  "file",
      -  "name"
      -]New value: +[
      +  "budget",
      +  "file",
      +  "name"
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "approx_tokens": {
      +      "type": "integer"
      +    },
      +    "budget": {
      +      "type": "integer"
      +    },
      +    "file": {
      +      "type": "string"
      +    },
      +    "kind": {
      +      "type": "string"
      +    },
      +    "omitted": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "summary": {
      +      "type": "string"
      +    },
      +    "symbol": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "approx_tokens",
      +    "budget",
      +    "file",
      +    "kind",
      +    "omitted",
      +    "summary",
      +    "symbol"
      +  ],
      +  "type": "object"
      +}
  3. Changed2 schema fields changedv0.1.1
    • changedInput schema / properties / file / description
      Previous value: -"Path to a .hird source file."New value: +"Path to a .hird source file. Its directory's .hird files are compiled together as one program, so imported names resolve."
    • changedInput schema / properties / name / description
      Previous value: -"The symbol's name."New value: +"The symbol's name, as the file's source would write it: a local definition, a member imported with `use Mod.{name}`, or `Qualifier.name` through `use Mod`."
  4. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, and the description reinforces this by stating it writes/executes nothing and only compiles in memory (cached). It also discloses failure behavior, error codes, and the not_found shape, which goes beyond annotations and gives the agent actionable detail.

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 dense but front-loaded with the main purpose and usage; all sentences earn their place. It is somewhat long, but it packs a lot of necessary operational detail into a compact structure, so it earns a 4 rather than a 5.

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?

Given the tool's complexity, the rich annotations, and the presence of an output schema, the description is complete: it covers purpose, ordering semantics, omissions, failure codes, and read-only behavior. It also references sibling tools sufficiently. Nothing critical is missing.

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

Parameters3/5

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

Schema coverage is 100%, so parameters are fully described in the schema. The description adds a bit of context about token estimation and omission behavior but does not need to compensate for missing schema docs. Baseline 3 is appropriate.

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 clear verb ('Summarize') and resource ('one symbol'), and specifies the target use ('for an LLM prompt within an approximate token budget'). It explicitly distinguishes itself from siblings like lookup_definition, explain_effect_row, and render_ir_fragment, and describes return fields. The title also reinforces the intent.

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?

Provides direct guidance: 'Use it as the default way to bring a symbol into context' and explicitly lists alternatives for other needs (lookup_definition for location, explain_effect_row for effect explanations, render_ir_fragment for full body). This is ideal routing information.

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