reinitialize_indexer
Restart the TypeScript type indexer to detect new dependencies after package installations, ensuring accurate type definition discovery.
Instructions
Reinitialize the type indexer (useful after package installations)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workingDir | No | Optional working directory to reinitialize from |
Implementation Reference
- src/mcp-server.ts:395-418 (handler)The main execution logic for the 'reinitialize_indexer' tool. Updates project config if workingDir provided, recreates TypeIndexer, calls initialize(), and returns success response.private async handleReinitializeIndexer(workingDir?: string) { try { if (workingDir) { this.config = WorkspaceDetector.detectProjectConfig(workingDir); this.typeIndexer = new TypeIndexer(this.config); } await this.typeIndexer.initialize(); return { content: [ { type: "text", text: JSON.stringify({ message: "Type indexer reinitialized successfully", config: this.config }, null, 2) } ] }; } catch (error) { throw new Error(`Failed to reinitialize indexer: ${error instanceof Error ? error.message : String(error)}`); } }
- src/mcp-server.ts:189-202 (registration)Registers the tool in the ListTools response with name, description, and input schema.{ name: "reinitialize_indexer", description: "Reinitialize the type indexer (useful after package installations)", inputSchema: { type: "object", properties: { workingDir: { type: "string", description: "Optional working directory to reinitialize from" } }, additionalProperties: false } }
- src/mcp-server.ts:26-26 (schema)TypeScript interface definition for the tool's input arguments, used for type-safe validation.reinitialize_indexer: { workingDir?: string };
- src/mcp-server.ts:252-255 (registration)Switch case in CallToolRequest handler that validates arguments using the schema and dispatches to the handler function.case "reinitialize_indexer": { const reinitArgs = this.validateArgs<ToolArguments["reinitialize_indexer"]>(args); return await this.handleReinitializeIndexer(reinitArgs.workingDir); }