Skip to main content
Glama

get_source

Read-onlyIdempotent

Read the bounded source excerpt that produced an object (for example, an SV FF instance maps to its always_ff block; a netlist cell maps to its instantiation line).

Instructions

Read the bounded source excerpt that produced an object (for example, an SV FF instance maps to its always_ff block; a netlist cell maps to its instantiation line). Use when exact source text is needed; use get_intent for typedef/enum/parameter semantics. When the response lists origins (e.g. Yosys src attributes), call again with origin=N to read that RTL. Returns object, file, start/end range, text, and truncation status without modifying files; missing paths and source ranges return structured errors.

Input Schema

NameRequiredDescriptionDefault
pathYesExact hierarchical path to a loaded design object.
originNoIndex into the object's `origins` list to read an upstream source (e.g. the RTL behind a Yosys netlist cell) instead of its declaration.
context_linesNoExtra lines before and after the source range; clamped to 0..20.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / origin
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Index into the object's `origins` list to read an upstream source (e.g. the RTL behind a Yosys netlist cell) instead of its declaration.",
      +  "title": "Origin"
      +}
    • changedInput schema / properties / path / description
      Previous value: -"Exact hierarchical path to an object from a SystemVerilog load."New value: +"Exact hierarchical path to a loaded design object."
  2. Changed2 schema fields changedv0.1.9
    • addedInput schema / properties / context_lines / description
      Added value: +"Extra lines before and after the source range; clamped to 0..20."
    • addedInput schema / properties / path / description
      Added value: +"Exact hierarchical path to an object from a SystemVerilog load."
  3. First observedv0.1.8

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent and non-destructive, so the safety profile is covered. The description adds real behavioral context beyond that: the origin re-call workflow, the fields returned (object, file, start/end range, text, truncation status), and structured errors on missing paths. It exceeds the annotation bar without contradicting anything.

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 before the alternatives and the origin workflow. It is dense but every sentence (examples, alternative, workflow, return/error behavior) earns its place; the parenthetical examples are the only mild padding.

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 no output schema, the description carries the return-value burden and does so: it names the returned fields, truncation status, and structured error behavior for missing paths. Combined with full schema coverage and annotations, an agent has everything needed to call it 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?

Schema coverage is 100%, so the baseline would be 3. The description still adds meaning by framing origin as a two-step workflow (list origins, then re-call with origin=N) and by contrasting it with reading a declaration, which is more than the schema's field-level text conveys.

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 (read the bounded source excerpt that produced an object) and grounds it with concrete examples mapping an SV FF instance to its always_ff block. It explicitly distinguishes itself from the sibling get_intent by scope, so an agent can route without opening either 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?

Gives an explicit when-to-use ('when exact source text is needed'), names the alternative and its domain ('use get_intent for typedef/enum/parameter semantics'), and describes the follow-up workflow (call again with origin=N when the response lists origins). 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.