Skip to main content
Glama

Index Content

ctx_index

Index large documentation, API references, or code files into a searchable knowledge base. Splits markdown by headings, preserves code blocks, and returns metadata for on-demand retrieval via search.

Instructions

Store content in a searchable knowledge base (BM25 over FTS5). Splits markdown by headings, keeps code blocks intact, and persists the raw chunks. The full content stays in storage — retrieve any section on-demand via ctx_search; nothing is summarized or truncated.

WHEN:

  • Documentation from Context7, Skills, or MCP tools (API docs, framework guides, code examples)

  • API references (endpoint details, parameter specs, response schemas)

  • MCP tools/list output (exact tool signatures and descriptions)

  • Skill prompts and instructions that are too large to keep verbatim in conversation

  • README files, migration guides, changelog entries

  • Any content with code examples you may need to reference precisely later

WHEN NOT:

  • Log files, test output, CSV, or build output — use ctx_execute_file, which processes in-sandbox without persisting bytes

  • Single-use ephemeral content you will not query later — keep it inline if it fits, or ctx_execute_file it

RETURNS: Indexing metadata: chunk counts (total, code-bearing), source label, and the exact ctx_search call shape to query the indexed content. Raw content is NOT echoed back — it lives in storage, retrievable via ctx_search(source: ""). When path is provided, a content hash is stored so ctx_search results auto-flag staleness on future calls.

EXAMPLE: ctx_index(content: "# React useEffect\n\nThe Effect Hook lets you ...", source: "react-useeffect-docs") EXAMPLE: ctx_index(path: "/path/to/large-spec.md", source: "openapi-v2-spec")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoRaw text/markdown to index. Provide this OR path, not both.
pathNoFile OR directory path to read and index (content never enters context). Provide this OR content. Directory paths trigger a bounded recursive walk (#687).
sourceNoLabel for the indexed content (e.g., 'Context7: React useEffect', 'Skill: frontend-design')
includeNoDirectory-only: glob patterns to include (default: all matching extensions).
excludeNoDirectory-only: glob patterns to exclude. Merged with defaults (node_modules, .git, dist, build, .next, coverage, .venv, __pycache__, .DS_Store).
maxDepthNoDirectory-only: max recursion depth from root (default: 5).
maxFilesNoDirectory-only: hard cap on files indexed (default: 200) — FTS5 blow-up guard.
extensionsNoDirectory-only: allowed file extensions (default: .md .mdx .txt .json .yaml .yml .ts .tsx .js .jsx .py .rs .go .sh).
respectGitignoreNoDirectory-only: apply nearest .gitignore (default: true).
followSymlinksNoDirectory-only: follow directory symlinks (default: false — cycle hazard + escape risk).
Behavior4/5

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

The description details behavior: markdown splitting, code block preservation, persistence of raw chunks, no summarization/truncation, and hash-based staleness detection for path indexing. No annotations were provided, so the description carries full burden and does well, though it omits mention of idempotency or reindexing behavior.

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

Conciseness5/5

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

The description is well-structured with headings (WHEN, WHEN NOT, RETURNS, EXAMPLE), front-loaded with the core purpose, and each sentence adds value. Despite length, it is justified by the tool's complexity (10 parameters) and remains scannable.

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

Completeness5/5

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

Given the tool's complexity, lack of annotations, and no output schema, the description thoroughly covers usage, return values, directory scanning behavior, staleness detection, and examples, leaving little ambiguity for an agent.

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?

Schema description coverage is 100%, so baseline is 3. The description adds value beyond the schema by explaining mutual exclusivity of content and path, showing examples, and clarifying directory-only parameter effects (e.g., glob patterns, recursion limits).

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?

The description clearly states the tool's purpose: to store content in a searchable knowledge base using BM25 over FTS5, with markdown splitting and intact code blocks. It distinguishes itself from sibling tools like ctx_execute_file (for ephemeral content) and ctx_search (for retrieval).

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?

The description includes explicit 'WHEN' and 'WHEN NOT' sections listing specific use cases (documentation, API references, skill prompts) and exclusions (log files, ephemeral content), with direct references to alternatives like ctx_execute_file.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mksglu/context-mode'

If you have feedback or need assistance with the MCP directory API, please join our Discord server