Skip to main content
Glama
blakeyoder

TypeScript Definitions MCP Server

by blakeyoder

reinitialize_indexer

Refresh TypeScript type definitions after installing packages to ensure accurate interface discovery and type-safe mock generation.

Instructions

Reinitialize the type indexer (useful after package installations)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workingDirNoOptional working directory to reinitialize from

Implementation Reference

  • The handler function that executes the reinitialize_indexer tool logic. It optionally updates the working directory and config, then calls the typeIndexer.initialize() method, returning a success message.
    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)}`);
      }
    }
  • Registration of the reinitialize_indexer tool in the ListTools response, including name, description, and input schema definition.
    {
      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
      }
    }
  • The switch case in CallToolRequest handler that routes the reinitialize_indexer tool call to the handleReinitializeIndexer method after argument validation.
    case "reinitialize_indexer": {
      const reinitArgs = this.validateArgs<ToolArguments["reinitialize_indexer"]>(args);
      return await this.handleReinitializeIndexer(reinitArgs.workingDir);
    }
  • TypeScript interface definition for the tool arguments used in validateArgs for type safety.
    reinitialize_indexer: { workingDir?: string };

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/blakeyoder/typescript-definitions-mcp'

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