Skip to main content
Glama

load-api-operation-by-path-and-method

Retrieve specific API operation details using path and HTTP method to access OpenAPI specifications within development tools.

Instructions

Load an operation by path and method

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
specIdYes
pathYes
methodYes

Implementation Reference

  • Registers the MCP tool 'load-api-operation-by-path-and-method' with description, input schema, and inline handler.
    server.tool(
      "load-api-operation-by-path-and-method",
      "Load an operation by path and method",
      {
        specId: z.string(),
        path: z.string(),
        method: z.string(),
      },
      async (args, extra) => {
        try {
          this.logger.debug('Loading API operation by path and method', {
            specId: args.specId,
            path: args.path,
            method: args.method
          });
          const operation = await this.specExplorer.findOperationByPathAndMethod(
            args.specId,
            args.path,
            args.method
          );
          if (!operation) {
            this.logger.warn('Operation not found', {
              specId: args.specId,
              path: args.path,
              method: args.method
            });
          }
          return {
            content: [
              { type: "text", text: stringify(operation, { indent: 2 }) },
            ],
          };
        } catch (error) {
          this.logger.error('Failed to load API operation by path and method', {
            error,
            specId: args.specId,
            path: args.path,
            method: args.method
          });
          throw error;
        }
      }
    );
  • Input schema definition using Zod for specId, path, and method parameters.
    {
      specId: z.string(),
      path: z.string(),
      method: z.string(),
    },
  • Handler function that invokes specExplorer.findOperationByPathAndMethod, handles errors, and returns the operation as YAML.
    async (args, extra) => {
      try {
        this.logger.debug('Loading API operation by path and method', {
          specId: args.specId,
          path: args.path,
          method: args.method
        });
        const operation = await this.specExplorer.findOperationByPathAndMethod(
          args.specId,
          args.path,
          args.method
        );
        if (!operation) {
          this.logger.warn('Operation not found', {
            specId: args.specId,
            path: args.path,
            method: args.method
          });
        }
        return {
          content: [
            { type: "text", text: stringify(operation, { indent: 2 }) },
          ],
        };
      } catch (error) {
        this.logger.error('Failed to load API operation by path and method', {
          error,
          specId: args.specId,
          path: args.path,
          method: args.method
        });
        throw error;
      }
    }
  • Implements findOperationByPathAndMethod to retrieve OpenAPI operation object from spec.paths[path][method].
    async findOperationByPathAndMethod(
      specId: string,
      path: string,
      method: string
    ): Promise<LoadOperationResult | null> {
      const spec = this.specs[specId];
      if (!spec) {
        return null;
      }
      const pathItem = spec.paths[path];
      if (!pathItem) {
        return null;
      }
      const operation = pathItem[method];
      if (!operation) {
        return null;
      }
      return {
        path,
        method,
        operation,
        specId,
        uri: `apis://${specId}/operations/${operation.operationId}`,
      };
    }
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. 'Load' implies a read operation, but it doesn't specify if this requires authentication, what happens on failure (e.g., if path/method not found), rate limits, or the return format. The description is minimal and lacks critical behavioral context for a tool with parameters.

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 extremely concise with a single sentence 'Load an operation by path and method', which is front-loaded and wastes no words. However, this conciseness comes at the cost of completeness, but for this dimension alone, it's efficiently structured.

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 tool has 3 parameters with 0% schema coverage, no annotations, no output schema, and multiple siblings, the description is incomplete. It doesn't explain the operation's context (e.g., API specifications), parameter details, expected output, or how it differs from similar tools, leaving significant gaps for an AI agent to use it correctly.

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?

The description mentions 'by path and method', which hints at two parameters, but doesn't explain the three parameters (specId, path, method) or their meanings. With 0% schema description coverage, the description fails to compensate—it doesn't clarify what specId refers to, the format of path/method, or examples of usage.

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 an operation by path and method' states a clear verb ('Load') and resource ('operation'), but it's vague about what type of operation and lacks differentiation from siblings like 'load-api-operation-by-operationId' or 'search-api-operations'. It doesn't specify if this is for API specifications, OpenAPI operations, or another context.

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. With siblings like 'load-api-operation-by-operationId' (using operationId) and 'search-api-operations' (searching), there's no indication of when path/method lookup is preferred over other methods, nor any prerequisites or exclusions mentioned.

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