Skip to main content
Glama

search-api-schemas

Search for API schemas across OpenAPI specifications to help developers find and understand API structures within their development tools.

Instructions

Search for schemas across specifications

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
specIdNo

Implementation Reference

  • Executes the tool logic: logs the search, calls specExplorer.searchSchemas, stringifies results to YAML, and returns as text content.
    async (args, extra) => {
      try {
        this.logger.debug('Searching API schemas', { query: args.query, specId: args.specId });
        const schemas = await this.specExplorer.searchSchemas(args.query, args.specId);
        return {
          content: [
            { type: "text", text: stringify({ schemas }, { indent: 2 }) },
          ],
        };
      } catch (error) {
        this.logger.error('Failed to search API schemas', { error, query: args.query });
        throw error;
      }
    }
  • Input parameters schema using Zod: query (string, required), specId (string, optional).
      query: z.string(),
      specId: z.string().optional(),
    },
  • Registers the 'search-api-schemas' tool on the MCP server with name, description, input schema, and handler.
    server.tool(
      "search-api-schemas",
      "Search for schemas across specifications",
      {
        query: z.string(),
        specId: z.string().optional(),
      },
      async (args, extra) => {
        try {
          this.logger.debug('Searching API schemas', { query: args.query, specId: args.specId });
          const schemas = await this.specExplorer.searchSchemas(args.query, args.specId);
          return {
            content: [
              { type: "text", text: stringify({ schemas }, { indent: 2 }) },
            ],
          };
        } catch (error) {
          this.logger.error('Failed to search API schemas', { error, query: args.query });
          throw error;
        }
      }
    );
  • Implements the schema search functionality using Fuse.js for fuzzy matching on schema names and descriptions across specified or all specs.
    async searchSchemas(
      query: string,
      specId?: string
    ): Promise<SpecSchemaEntry[]> {
      const targetSpecs: SpecCatalogEntry[] = [];
      if (specId) {
        const spec = this.catalog.find((spec) => spec.uri.specId === specId);
        if (spec) {
          targetSpecs.push(spec);
        }
      } else {
        targetSpecs.push(...this.catalog);
      }
    
      const schemaEntries: SpecSchemaEntry[] = [];
      for (const spec of targetSpecs) {
        schemaEntries.push(
          ...spec.schemas.map((schema) => ({
            ...schema,
            specId: spec.uri.specId,
          }))
        );
      }
    
      const fuse = new Fuse(schemaEntries, {
        includeScore: true,
        threshold: 0.2,
        keys: ["name", "description"],
      });
    
      const results = fuse.search(query);
      return results.map((result) => result.item);
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool searches but doesn't explain what 'search' entails—whether it's fuzzy matching, exact matches, pagination, rate limits, or authentication needs. For a search tool with zero annotation coverage, 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 appropriately sized and front-loaded, clearly stating the tool's purpose 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?

Given the complexity of a search tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't cover parameter semantics, behavioral traits, or return values, making it inadequate for effective tool selection and invocation.

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

Parameters2/5

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

Schema description coverage is 0%, so the schema provides no parameter details. The description mentions 'search for schemas' but doesn't explain what 'query' or 'specId' parameters mean, their formats, or how they interact. It adds minimal value beyond the schema, failing to compensate for the coverage gap.

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 action ('Search for') and resource ('schemas across specifications'), providing a specific verb+resource combination. However, it doesn't differentiate this tool from its sibling 'search-api-operations', which searches for operations rather than schemas, so it misses the highest score.

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 'load-api-schema-by-schemaName' or 'search-api-operations'. There's no mention of prerequisites, context, or exclusions, leaving the agent with minimal usage direction.

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/ReAPI-com/mcp-openapi'

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