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']
sample_limit integer 5 —

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 v14.7.0 source:

Parse a file or directory into semantic AST chunks (functions, classes, methods) across 8 languages. Returns chunk count + sample.

Found a mistake? Open an issue on GitHub.

Search