Skip to main content
Glama

Get Code Chunk

get_code_chunk

Retrieve indexed AST chunks for a known file path to fetch only relevant code instead of reading entire files, reducing token usage.

Instructions

Retrieve indexed AST chunks for a known file path instead of reading the whole file.

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": {
      "file_path": "<file_path>"
    },
    "name": "get_code_chunk"
  }
}

Input Schema

NameRequiredDescriptionDefault
file_pathYes
node_typeNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden. It discloses only that results come from an index and are AST-level chunks; it says nothing about permissions, index staleness, behavior for unindexed or missing files, or result limits. An output schema exists, so return shape needn't be explained, but the operational traits are missing.

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?

A single front-loaded sentence with no filler; the alternative (reading the whole file) is placed where it does the most work. Its brevity is efficient rather than padded, though it borders on under-specification.

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

Completeness2/5

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

The output schema relieves it of explaining return values, but with zero annotation coverage, zero parameter description coverage, and two parameters, the definition is too thin. A reader cannot determine what node_type does or how the index behaves for unindexed files.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It implies the file_path meaning but never mentions node_type, leaving an entire parameter (the AST node type filter, with an empty-string default) unexplained in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ("Retrieve") and a specific resource ("indexed AST chunks"), scoped to "a known file path". This distinguishes it from the whole-file reading pattern it names, though it never mentions the sibling search_code, so the search-vs-fetch split must be inferred from the sibling's name alone.

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

Usage Guidelines3/5

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

"for a known file path instead of reading the whole file" gives a usable precondition and names one alternative approach. It does not address what to do when the path is unknown or how this relates to search_code, so guidance is implied rather than explicit.

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

Deploy Server

Other Tools