Skip to main content
Glama
blakeyoder

TypeScript Definitions MCP Server

by blakeyoder

find_interfaces

Search for TypeScript interfaces by name pattern to access type definitions from project dependencies for generating type-safe mocks and test data.

Instructions

Find interfaces matching a pattern

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesPattern to match interface names (supports wildcards with *)

Implementation Reference

  • Executes the tool logic by calling the type indexer's findInterfaces method with the pattern and returns a formatted JSON response containing matching interfaces.
    private async handleFindInterfaces(pattern: string) {
      const results = await this.typeIndexer.findInterfaces(pattern);
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              pattern,
              results,
              count: results.length
            }, null, 2)
          }
        ]
      };
  • JSON Schema defining the input for the find_interfaces tool: an object with a required 'pattern' string property.
    inputSchema: {
      type: "object",
      properties: {
        pattern: {
          type: "string",
          description: "Pattern to match interface names (supports wildcards with *)"
        }
      },
      required: ["pattern"]
  • Registration of the find_interfaces tool in the ListToolsRequestSchema response, including name, description, and input schema.
    {
      name: "find_interfaces",
      description: "Find interfaces matching a pattern",
      inputSchema: {
        type: "object",
        properties: {
          pattern: {
            type: "string",
            description: "Pattern to match interface names (supports wildcards with *)"
          }
        },
        required: ["pattern"]
      }
    },
  • Supporting method in TypeIndexer that implements the core logic: scans source files, extracts type definitions, filters interfaces matching the regex-converted pattern.
    async findInterfaces(pattern: string): Promise<TypeDefinition[]> {
      if (!this.program) {
        throw new Error("TypeIndexer not initialized. Call initialize() first.");
      }
    
      const results: TypeDefinition[] = [];
      const regex = new RegExp(pattern.replace(/\*/g, ".*"));
      
      for (const sourceFile of this.program.getSourceFiles()) {
        const definitions = this.extractTypeDefinitions(sourceFile);
        const matching = definitions.filter(def => 
          def.kind === "interface" && regex.test(def.name)
        );
        results.push(...matching);
      }
      
      return results;
  • Handler dispatch registration in the CallToolRequestSchema switch statement for routing find_interfaces calls to the handler.
    case "find_interfaces": {
      const interfaceArgs = this.validateArgs<ToolArguments["find_interfaces"]>(args);
      return await this.handleFindInterfaces(interfaceArgs.pattern);
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions pattern matching with wildcards, but doesn't disclose whether this is a read-only operation, what permissions are needed, how results are returned, or any rate limits. For a search tool with zero annotation coverage, this is inadequate.

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 wasted words. It's appropriately sized for a simple search tool and gets straight to the point without unnecessary elaboration.

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?

For a search tool with no annotations and no output schema, the description is insufficient. It doesn't explain what constitutes an 'interface' in this context, what format results are returned in, or how pattern matching behaves beyond the basic wildcard mention. The agent lacks critical context for proper tool selection and 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 the single 'pattern' parameter with its wildcard support. The description adds no additional parameter semantics beyond what's in the schema, meeting the baseline for high schema coverage.

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 verb 'find' and resource 'interfaces matching a pattern', which is specific and actionable. It doesn't explicitly distinguish from siblings like 'lookup_type' or 'validate_interface_implementation', but the focus on pattern-based searching provides reasonable differentiation.

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 'lookup_type' or 'validate_interface_implementation'. There's no mention of prerequisites, context, or comparison with sibling tools, leaving the agent to guess based on tool names alone.

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