seroost_index
Builds a searchable index for codebases by processing all files in a configured directory, enabling fast semantic searches with natural language queries.
Instructions
Build the search index for the previously configured directory path. This processes all files in the target directory and creates a searchable index. Must run after setting the index path with seroost_set_index. Indexing may take time for large codebases but enables fast subsequent searches.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:89-116 (registration)Registration of the 'seroost_index' MCP tool, including empty input schema and inline handler function that invokes runIndex() from commands.ts and returns formatted success/failure response.server.tool( "seroost_index", "Build the search index for the previously configured directory path. This processes all files in the target directory and creates a searchable index. Must run after setting the index path with seroost_set_index. Indexing may take time for large codebases but enables fast subsequent searches.", {}, // No parameters needed - uses the path set by seroost_set_index async () => { try { let output = await runIndex(); return { content: [ { type: "text", text: output ? "success" : "no output returned", }, ], }; } catch (error) { return { content: [ { type: "text", text: "failure", }, ], }; } } );
- src/index.ts:93-115 (handler)Inline handler function for seroost_index tool execution: awaits runIndex(), handles errors, returns MCP content block with status.async () => { try { let output = await runIndex(); return { content: [ { type: "text", text: output ? "success" : "no output returned", }, ], }; } catch (error) { return { content: [ { type: "text", text: "failure", }, ], }; } }
- src/commands.ts:11-15 (helper)runIndex helper: prepares 'index' arguments and calls runSeroost to spawn the seroost binary for indexing.export function runIndex() { const args = ["index"]; return runSeroost(args); }
- src/commands.ts:24-45 (helper)runSeroost utility: spawns child_process 'seroost' CLI with args, streams stdout/stderr, resolves with output on success (code 0), rejects on error.function runSeroost(args: string[]) { return new Promise((resolve, reject) => { const proc = spawn("seroost", args); let out = ""; let err = ""; proc.stdout.on("data", (d) => (out += d.toString())); proc.stderr.on("data", (d) => (err += d.toString())); proc.on("close", (code) => { if (code === 0) { try { resolve(out); } catch { reject(new Error("Invalid JSON from Seroost: " + out)); } } else { reject(new Error(err || "Seroost failed")); } }); }); }