Skip to main content
Glama

scan_codebase

Idempotent

Scan and analyze a codebase with tree-sitter, producing a structured context payload.

Instructions

Scan and analyze a codebase with tree-sitter, producing a structured context payload.

Performs AST analysis, change detection, and caching. Writes the analysis payload to disk and returns instructions to retrieve it via read_payload_chunk. The payload contains pure architectural data — no AGENTS.md writing instructions.

Use this tool when you need deep codebase understanding for any task (code review, refactoring, planning, Q&A). To generate or update AGENTS.md specifically, use generate_agents_md instead — it orchestrates the full workflow automatically.

Supported languages: Python, C#, TypeScript, JavaScript, Go.

Args: params (ScanCodebaseInput): Input parameters containing: - project_path (str): Path to the project root (default: ".") - force_full_scan (bool): Ignore cache and rescan everything (default: False).

Returns: str: JSON with total_chunks and instructions to call read_payload_chunk.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.6.0
    • changedInput schema / $defs / ScanCodebaseInput / properties / force_full_scan / default
      Previous value: -trueNew value: +false
    • changedInput schema / $defs / ScanCodebaseInput / properties / force_full_scan / description
      Previous value: -"Force a full scan ignoring any existing cache. Defaults to True — direct calls always perform a full scan for complete context. Set to False only when called as part of an incremental update workflow (e.g. orchestrated by generate_agents_md)."New value: +"Force a full scan ignoring any existing cache. Defaults to False — incremental scans reuse the cache and only re-analyze changed files. Set to True only when the user explicitly requests a full rescan."
  2. First observedv0.5.3

TDQS

A4.5/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false, idempotentHint=true, destructiveHint=false, and the description is consistent with that by disclosing that the tool writes the analysis payload to disk and returns instructions to fetch it via read_payload_chunk. It also discloses caching and change-detection behavior, which the annotations do not cover. It stops short of describing the write location, payload size limits, or failure modes for unsupported languages.

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 capability and the sibling routing in the first two paragraphs, with Args/Returns kept short. The 'Args:'/'Returns:' block is somewhat boilerplate, but every sentence is answerable and none is pure filler.

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?

An output schema exists, so return-value detail is not required, yet the description still states the payload is retrieved in chunks via read_payload_chunk, which is the key follow-up action. Behavior, routing, and language coverage are all present; only the disk-write specifics and error handling are absent.

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?

The reported top-level schema coverage is 0% (the only property is a $ref), so the description carries the burden, and it does document both nested fields with defaults. However, the wording for force_full_scan largely duplicates the schema's own description, so it adds little semantic depth beyond restating cache-ignore behavior.

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+resource (scan/analyze a codebase with tree-sitter) and the concrete artifact produced (a structured context payload). It also names the sibling it is not (generate_agents_md) and lists supported languages, so an agent can distinguish it from the other two tools 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?

Explicit when-to-use ('deep codebase understanding for code review, refactoring, planning, Q&A') and an explicit when-not with the named alternative ('To generate or update AGENTS.md specifically, use generate_agents_md'). The routing decision is fully resolved in the text.

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