Skip to main content
Glama

spec_nav_read_function

Read full function source, signatures, doc comments, imports, and line numbers by id or file/name; retrieve up to 10 functions, line windows, or paginated long functions.

Instructions

Read functions in full (signature, doc comment, imports used, source with line numbers), up to 10 per call with functions. For code you will not edit; to edit a file, Read it (Edit requires that). Identify by id, or file+name (+line). For a long function or lines outside any function, pass lines to get only ±around lines. Long functions come in parts with a cursor; nothing is cut silently. Answers STALE if the code changed since the id was issued. Does not say whether another service may import it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
fileNoPath relative to the repo root.
lineNoA line inside the function, to disambiguate.
nameNoQualified ("OrderService.calculateFee"), short, or exported name.
linesNoRead only ±`around` lines around these file lines. With `file` alone: windows anywhere in the file.
aroundNoLines either side of each of `lines` (default 15, max 60).
cursorNonextCursor from the previous part; refuses if the function changed.
formatNo"text" (default, compact) or "json" (structured).
fromLineNoContinue a long function from this file line.
maxLinesNoLines per part (default 400).
functionsNoUp to 10 functions, each by `id` or `file`+`name` (+`line`), or only windows with `lines`. Instead of the single-function fields.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.8.0
    • addedInput schema / properties / around
      Added value: +{
      +  "description": "Lines either side of each of `lines` (default 15, max 60).",
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • changedInput schema / properties / cursor / description
      Previous value: -"nextCursor from the previous part: continues there even if the function moved; refuses if it changed."New value: +"nextCursor from the previous part; refuses if the function changed."
    • changedInput schema / properties / functions / description
      Previous value: -"Read up to 10 functions at once, each by `id` or `file`+`name` (+ `line`). Use instead of the single-function fields below."New value: +"Up to 10 functions, each by `id` or `file`+`name` (+`line`), or only windows with `lines`. Instead of the single-function fields."
    • addedInput schema / properties / functions / items / properties / around
      Added value: +{
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / functions / items / properties / lines
      Added value: +{
      +  "items": {
      +    "exclusiveMinimum": 0,
      +    "type": "integer"
      +  },
      +  "maxItems": 40,
      +  "type": "array"
      +}
    • addedInput schema / properties / lines
      Added value: +{
      +  "description": "Read only ±`around` lines around these file lines. With `file` alone: windows anywhere in the file.",
      +  "items": {
      +    "exclusiveMinimum": 0,
      +    "type": "integer"
      +  },
      +  "maxItems": 40,
      +  "type": "array"
      +}
  2. Changed7 schema fields changedv0.7.0
    • changedInput schema / properties / cursor / description
      Previous value: -"nextCursor from the previous part: continues there even if the code moved; refuses if it changed."New value: +"nextCursor from the previous part: continues there even if the function moved; refuses if it changed."
    • changedInput schema / properties / file / description
      Previous value: -"Path relative to the repo root. Alone (no `name`): the whole file."New value: +"Path relative to the repo root."
    • changedInput schema / properties / fromLine / description
      Previous value: -"Continue a long function, class or file from this file line."New value: +"Continue a long function from this file line."
    • changedInput schema / properties / functions / description
      Previous value: -"Read up to 10 at once: a function by `id` or `file`+`name` (+ `line`), a class by `file` + its name, a whole file by `file` alone. Use instead of the single-read fields below."New value: +"Read up to 10 functions at once, each by `id` or `file`+`name` (+ `line`). Use instead of the single-function fields below."
    • changedInput schema / properties / line / description
      Previous value: -"A line inside the function or class, to disambiguate."New value: +"A line inside the function, to disambiguate."
    • changedInput schema / properties / maxLines / description
      Previous value: -"Lines per part (default 400 for a function, 1000 for a class or file)."New value: +"Lines per part (default 400)."
    • changedInput schema / properties / name / description
      Previous value: -"Function: qualified (\"OrderService.calculateFee\"), short, or exported name. Class: its name (\"OrderService\") — the whole class."New value: +"Qualified (\"OrderService.calculateFee\"), short, or exported name."
  3. Changed7 schema fields changedv0.6.0
    • changedInput schema / properties / cursor / description
      Previous value: -"nextCursor from the previous part: continues there even if the function moved; refuses if it changed."New value: +"nextCursor from the previous part: continues there even if the code moved; refuses if it changed."
    • changedInput schema / properties / file / description
      Previous value: -"Path relative to the repo root."New value: +"Path relative to the repo root. Alone (no `name`): the whole file."
    • changedInput schema / properties / fromLine / description
      Previous value: -"Continue a long function from this file line."New value: +"Continue a long function, class or file from this file line."
    • addedInput schema / properties / functions
      Added value: +{
      +  "description": "Read up to 10 at once: a function by `id` or `file`+`name` (+ `line`), a class by `file` + its name, a whole file by `file` alone. Use instead of the single-read fields below.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "file": {
      +        "type": "string"
      +      },
      +      "id": {
      +        "type": "string"
      +      },
      +      "line": {
      +        "exclusiveMinimum": 0,
      +        "type": "integer"
      +      },
      +      "name": {
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "maxItems": 10,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • changedInput schema / properties / line / description
      Previous value: -"A line inside the function, to disambiguate."New value: +"A line inside the function or class, to disambiguate."
    • changedInput schema / properties / maxLines / description
      Previous value: -"Lines per part (default 400)."New value: +"Lines per part (default 400 for a function, 1000 for a class or file)."
    • changedInput schema / properties / name / description
      Previous value: -"Qualified (\"OrderService.calculateFee\"), short, or exported name."New value: +"Function: qualified (\"OrderService.calculateFee\"), short, or exported name. Class: its name (\"OrderService\") — the whole class."
  4. First observedv0.4.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it discloses the 10-per-call limit, cursor-based pagination for long functions, that nothing is cut silently, staleness behavior for issued ids, and cursor refusal on changed functions. It omits permission/error-shape details, and the closing note about not reporting cross-service imports is a useful but narrow caveat.

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?

Dense and front-loaded, with the core purpose and return shape first, then usage routing, then pagination and limits. Nearly every clause carries information, though the parenthetical-heavy style and the trailing import caveat make it slightly heavier than necessary.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 11-parameter, zero-annotation tool with no output schema, the description covers the modes of use, batching, pagination, truncation, and staleness. What remains thin is the distinction from non-sibling tools and any note on permissions, but nothing essential to calling it 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 91% so the baseline is 3, but the description adds relational meaning the schema does not: the id-vs-file+name(+line) identification alternatives, the windowed lines/cursor workflow for long functions, and the batch functions array replacing the single-function fields. That is genuine semantics beyond the per-property descriptions.

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 functions in full) and enumerates exactly what is returned: signature, doc comment, imports used, source with line numbers. This clearly distinguishes it from the discovery-oriented siblings like spec_nav_find_functions and spec_nav_functions.

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?

Explicitly frames when to use it (code you will not edit) and when not (to edit a file, use Read, since Edit requires it), naming the alternative tool. It also states the acceptable identification modes (id, or file+name+line), so the agent knows how to select and route.

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