Skip to main content
Glama

add_code_chunk

Index code chunks for semantic search by automatically splitting content with tree-sitter and storing them in a codebase directory.

Instructions

Index a code chunk for semantic search.
Automatically chunks the content using tree-sitter.

Args:
    filepath: Path to the code file
    content: Code content to index
    directory: Path to the codebase directory (index will be stored here)

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": {
      "filepath": "<filepath>",
      "content": "<content>",
      "directory": "<directory>"
    },
    "name": "add_code_chunk"
  }
}

Input Schema

NameRequiredDescriptionDefault
contentYes
filepathYes
directoryYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.1/5.0
Behavior3/5

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

With no annotations, the description carries full burden and does disclose one key behavior: content is auto-chunked via tree-sitter, and the index is persisted to the given directory. It omits what happens on re-adding the same filepath (overwrite vs duplicate), whether an index must already exist, and any cost/embedding implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two lead sentences are front-loaded and efficient. The following Args block restates parameter names in prose, which is somewhat bulky, but it is the sole source of parameter meaning so it largely earns its place.

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

Completeness3/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 values need not be explained, and all three required parameters get a one-line definition. Still missing for a write/indexing tool are prerequisites (must a directory index exist first?), duplicate handling, and confirmation of what side effects appear in search results.

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

Parameters3/5

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

Schema coverage is 0%, so the Args block is the only parameter documentation and it does add value, especially 'index will be stored here' for directory. However, it leaves the critical relationship unresolved: is filepath relative to directory, and why are both filepath and content required together?

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 and resource: index a code chunk for semantic search, with a concrete implementation note (tree-sitter chunking). It is clearly a single-chunk ingestion tool, but it never distinguishes itself from index_directory, which by name alone suggests a closely related bulk operation.

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

Usage Guidelines2/5

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

There is no explicit when-to-use or when-not-to-use statement. The agent must infer that this is for a single chunk rather than a whole codebase, and there is no pointer to index_directory/sync_index as the alternative for bulk or refresh operations.

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