Skip to main content
Glama

list_corpora

Read-onlyIdempotent

Discover all saved corpora on disk with their manifest details including scope, project root, sizes, and timestamps to identify which corpora are available for querying.

Instructions

List every corpus saved on disk with its manifest (scope, project_root, sizes, timestamps). Read-only. Use to discover what corpora are available to query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler: The MCP tool handler for 'list_corpora'. Lists all saved corpora on disk by calling corpora.list() and returns the array of manifests with a total count. No input schema needed (empty object).
    server.tool(
      'list_corpora',
      'List every corpus saved on disk with its manifest (scope, project_root, sizes, timestamps). Read-only. Use to discover what corpora are available to query.',
      {},
      async () => {
        const items = corpora.list();
        return {
          content: [{ type: 'text', text: j({ corpora: items, total: items.length }) }],
        };
      },
    );
  • Helper: CorpusStore.list() — iterates over the corpora directory, reads each .json manifest file, validates name against NAME_PATTERN, loads the manifest, and returns them sorted alphabetically.
    /** List every corpus manifest currently on disk. */
    list(): CorpusManifest[] {
      if (!fs.existsSync(this.rootDir)) return [];
      const entries = fs.readdirSync(this.rootDir, { withFileTypes: true });
      const out: CorpusManifest[] = [];
      for (const entry of entries) {
        if (!entry.isFile()) continue;
        if (!entry.name.endsWith('.json')) continue;
        const name = entry.name.slice(0, -'.json'.length);
        // Hidden / sidecar files (e.g. .DS_Store after `.json` strip) are
        // trivially rejected by NAME_PATTERN.
        if (!NAME_PATTERN.test(name)) continue;
        const manifest = this.load(name);
        if (manifest !== null) out.push(manifest);
      }
      out.sort((a, b) => a.name.localeCompare(b.name));
      return out;
    }
  • Registration: The call to registerKnowledgeTools which registers all knowledge tools (including list_corpora) on the MCP server during server initialization.
    registerKnowledgeTools(server, ctx);
  • Schema: CorpusManifest interface — the type definition for each corpus manifest returned by list_corpora. Contains name, scope, sizes, timestamps, and other metadata.
    export interface CorpusManifest {
      /** User-supplied slug; primary key. */
      name: string;
      /** Absolute path of the project this corpus was built from. */
      projectRoot: string;
      /** Pack scope: project (whole repo) / module (subdir) / feature (NL query). */
      scope: CorpusScope;
      /** Subdirectory path when scope=module. */
      modulePath?: string;
      /** Natural-language query when scope=feature. */
      featureQuery?: string;
      /** Token budget passed to packContext. */
      tokenBudget: number;
      /** Symbols included (count after pack). */
      symbolCount: number;
      /** Files included (count after pack). */
      fileCount: number;
      /** Approximate token count of the packed text. */
      estimatedTokens: number;
      /** Provider used to embed / pack (informational). */
      packStrategy: 'most_relevant' | 'core_first' | 'compact';
      createdAt: string;
      updatedAt: string;
      /** Free-form description from the user. */
      description?: string;
    }
Behavior3/5

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

Annotations already declare readOnlyHint, destructiveHint, idempotentHint. Description adds 'Read-only' and mentions 'every corpus saved on disk.' No additional behavioral traits beyond annotations.

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?

Two concise sentences front-loading action, return info, safety, and usage. No wasted words.

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?

For a simple tool with no parameters and no output schema, the description covers purpose, return fields, safety, and usage completely.

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?

No parameters exist, so schema coverage is 100%. Description adds no parameter info because none needed. Baseline for 0 params is 4.

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?

Description clearly states the action (list) and resource (corpora), and specifies the returned data (manifest fields). It distinguishes from sibling tools like build_corpus, delete_corpus, etc.

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

Usage Guidelines4/5

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

Explicitly says 'Use to discover what corpora are available to query,' providing clear purpose. Does not explicitly state when not to use, but the context of siblings implies discovery is the primary use case.

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/nikolai-vysotskyi/trace-mcp'

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