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 };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool looks up type definitions but doesn't describe what 'look up' entails—whether it returns documentation, source code, metadata, or something else. It doesn't mention error handling, rate limits, authentication needs, or whether results are cached. For a tool with no annotations, this leaves significant behavioral gaps.

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?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and includes key details (TypeScript, name, optional package) without unnecessary elaboration. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., type signatures, documentation, or metadata), how results are formatted, or any limitations (e.g., only works for indexed packages). For a lookup tool with no structured output information, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('typeName' and 'packageName') with clear descriptions. The description adds marginal value by mentioning the optional package filter but doesn't provide additional syntax, format details, or examples beyond what the schema provides. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('look up') and resource ('TypeScript type definitions'), and specifies the lookup criteria ('by name and optional package'). However, it doesn't explicitly differentiate this from sibling tools like 'get_package_types' or 'find_interfaces', which might offer similar functionality.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_package_types' or 'find_interfaces'. It mentions the optional package parameter but doesn't explain when to include it or what happens if omitted. No prerequisites, exclusions, or comparison to siblings are provided.

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

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