Skip to main content
Glama

load-api-schema-by-schemaName

Retrieve specific API schema definitions from OpenAPI specifications to enable AI-powered development tools to understand and work with your APIs directly in IDE integrations.

Instructions

Load a schema by schemaName

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
specIdYes
schemaNameYes

Implementation Reference

  • Registration of the 'load-api-schema-by-schemaName' MCP tool, including input schema (specId and schemaName using Zod) and the inline handler function that delegates to specExplorer.findSchemaByName and returns the schema as YAML string.
    server.tool(
      "load-api-schema-by-schemaName",
      "Load a schema by schemaName",
      {
        specId: z.string(),
        schemaName: z.string(),
      },
      async (args, extra) => {
        try {
          this.logger.debug('Loading API schema', { specId: args.specId, schemaName: args.schemaName });
          const schema = await this.specExplorer.findSchemaByName(
            args.specId,
            args.schemaName
          );
          if (!schema) {
            this.logger.warn('Schema not found', { specId: args.specId, schemaName: args.schemaName });
          }
          return {
            content: [{ type: "text", text: stringify(schema, { indent: 2 }) }],
          };
        } catch (error) {
          this.logger.error('Failed to load API schema', {
            error,
            specId: args.specId,
            schemaName: args.schemaName
          });
          throw error;
        }
      }
    );
  • Zod input schema for the tool parameters: specId (string) and schemaName (string).
    {
      specId: z.string(),
      schemaName: z.string(),
    },
  • Core implementation of schema lookup by name in FileSystemSpecService: retrieves the OpenAPI spec from cache, extracts the schema from components.schemas[schemaName], and returns a structured LoadSchemaResult.
    async findSchemaByName(
      specId: string,
      schemaName: string
    ): Promise<LoadSchemaResult | null> {
      const spec = this.specs[specId];
      if (!spec) {
        return null;
      }
      const schema = spec.components?.schemas?.[schemaName];
      if (!schema) {
        return null;
      }
    
      // all references must have been dereferenced
      return {
        name: schemaName,
        description: schema["description"],
        schema: schema as OpenAPIV3.SchemaObject,
        uri: `apis://${specId}/schemas/${schemaName}`,
      };
    }
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 'load' but doesn't clarify if this is a read-only operation, requires authentication, has rate limits, or what the output entails. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. However, it's overly concise to the point of under-specification, as it lacks necessary details for effective tool use, slightly reducing its utility despite the clean structure.

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 no annotations, 0% schema coverage, no output schema, and multiple sibling tools, the description is incomplete. It doesn't provide enough context for an agent to reliably select or invoke this tool, especially compared to more detailed alternatives in the toolset.

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 'schemaName' but doesn't explain what 'specId' is or how these parameters relate to the loading process. It adds minimal value beyond naming one parameter, 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.

Purpose3/5

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

The description 'Load a schema by schemaName' states the basic action (load) and resource (schema), but is vague about what 'load' means in this context (e.g., retrieve, fetch, display). It doesn't differentiate from sibling tools like 'search-api-schemas' or 'get-api-catalog', leaving ambiguity about when to use this specific tool.

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?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'search-api-schemas' and 'get-api-catalog', the description lacks any context about prerequisites, specific use cases, or exclusions, 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/ReAPI-com/mcp-openapi'

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