Skip to main content
Glama
blakeyoder

TypeScript Definitions MCP Server

by blakeyoder

lookup_type

Find TypeScript type definitions by name and optional package to understand interface structures and generate type-safe code.

Instructions

Look up TypeScript type definitions by name and optional package

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNameYesThe name of the type to look up
packageNameNoOptional package name to filter results

Implementation Reference

  • The primary handler function for the 'lookup_type' tool. It invokes the TypeIndexer to find the type definition matching the given typeName and optional packageName, then formats and returns the results as a JSON string in the MCP response format.
    private async handleLookupType(typeName: string, packageName?: string) { const results = await this.typeIndexer.findType(typeName, packageName); return { content: [ { type: "text", text: JSON.stringify({ query: { typeName, packageName }, results, count: results.length }, null, 2) } ] }; }
  • Tool registration in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema for lookup_type.
    { name: "lookup_type", description: "Look up TypeScript type definitions by name and optional package", inputSchema: { type: "object", properties: { typeName: { type: "string", description: "The name of the type to look up" }, packageName: { type: "string", description: "Optional package name to filter results" } }, required: ["typeName"] } },
  • Dispatcher in the CallToolRequestSchema handler that validates arguments and routes to the lookup_type handler function.
    case "lookup_type": { const lookupArgs = this.validateArgs<ToolArguments["lookup_type"]>(args); return await this.handleLookupType(lookupArgs.typeName, lookupArgs.packageName); }
  • Internal TypeScript interface defining the argument types for all tools, including lookup_type, used for type-safe validation.
    interface ToolArguments { lookup_type: { typeName: string; packageName?: string }; validate_type_usage: { code: string; expectedType?: string }; find_interfaces: { pattern: string }; get_package_types: { packageName: string }; validate_interface_implementation: { implementation: string; interfaceName: string; interfaceDefinition: string; }; check_type_compatibility: { sourceType: string; targetType: string }; 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