Skip to content
Docs menu

Tool reference · Tasks, workflows & decisions

ingest_codebase

Splits a file or directory into functions, classes and methods using a syntax tree and reports what it found.

local stdio server writes
Caution. The tool only parses and returns counts and a sample; it does not save the chunks into memory. Large directories can take a while.

When to use

  • You want a quick inventory of the functions and classes in an unfamiliar repository.
  • You need to check which parts of a codebase the parser can read.
  • You want to limit parsing to certain extensions such as .py or .go.

Parameters

NameTypeDefaultDescription
pathrequired string — —
include string[] — Extension allowlist e.g. ['.py','.go']
action "index" | "preview" | "search" | "status" "index" —
project string "general" (min length 1)
query string "" —
exclude string[] — Override excluded directory/file glob patterns; [] includes dependency directories. Sensitive files remain protected.
sample_limit integer 5 —
watch boolean true Automatically refresh this index while the personal server runs.
limit integer 10 (min 0, max 100)
offset integer 0 (min 0)

Example

Arguments

{
  "path": "~/projects/billing-api/src",
  "include": [
    ".py"
  ],
  "sample_limit": 1
}

Result shape

{
  "path": "/Users/dev/projects/billing-api/src",
  "total_chunks": 214,
  "by_kind": {
    "function": 131,
    "class": 38,
    "method": 45
  },
  "sample": [
    {
      "file": "/Users/dev/projects/billing-api/src/billing/invoice.py",
      "language": "python",
      "kind": "function",
      "name": "total_with_tax",
      "signature": "def total_with_tax(lines: list[Line], rate: Decimal) -> Decimal:",
      "content": "def total_with_tax(lines, rate):\n    ...",
      "docstring": null,
      "start_line": 12,
      "end_line": 24,
      "parent": null,
      "extras": {}
    }
  ]
}

Recognises Python, TypeScript/TSX, JavaScript, Go, Rust, C++, Java, Ruby and C#. Files it cannot parse come back as a single chunk of kind "file".

Values are illustrative; the keys follow the server's handler. MCP clients receive the result as JSON text content.

Server description

The description the server sends to your agent in tools/list, captured from the v15.0.0 source:

Index a local file or directory persistently in separate TAM resource tables. All text formats are searchable; detected languages use tree-sitter AST. PDF/Office/archive text is extracted; other binary files have explicit metadata-only status. action=index updates changed files and removes deleted entries; preview does not write. Use action=search with query or action=status to inspect the project-scoped index. Sensitive files and excluded directories are reported without reading their contents.

Found a mistake? Open an issue on GitHub.

Search