Skip to main content
Glama
MarveleE
by MarveleE

rap2_search_interfaces_by_path

Search RAP2 API interfaces by request path to find documentation details. Optionally filter results by repository ID for targeted queries.

Instructions

按请求路径搜索接口(可选限定仓库)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes请求路径(如:/api/users)
repositoryIdNo仓库 ID(可选,传入字符串)

Implementation Reference

  • MCP server-side handler for the 'rap2_search_interfaces_by_path' tool call. Validates and normalizes input parameters (path and optional repositoryId), creates a Rap2Client instance, invokes the client's searchInterfacesByPath method, handles errors with logging, and returns the JSON-formatted result.
    if (name === 'rap2_search_interfaces_by_path') {
      const { path, repositoryId } = (req.params.arguments || {});
    
      const normalizedPath = validateAndNormalizeKeyword(path);
      const normalizedRepoId = validateAndNormalizeId('repositoryId', repositoryId, true); // 允许为空
    
      const client = createClient();
      const result = await client.searchInterfacesByPath(normalizedPath, normalizedRepoId);
    
      if (result?.error) {
        const errorMsg = String(result.error);
        logger.error({ tool: name, path: normalizedPath, repositoryId: normalizedRepoId, error: errorMsg }, 'tool failed');
        throw new Error(`按路径搜索接口失败: ${errorMsg}`);
      }
    
      logger.info({ tool: name, path: normalizedPath, repositoryId: normalizedRepoId, resultCount: Array.isArray(result) ? result.length : 0 }, 'tool success');
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Registration of the 'rap2_search_interfaces_by_path' tool in the MCP server's tools array, including description and input schema definition.
    {
      name: 'rap2_search_interfaces_by_path',
      description: '按请求路径搜索接口(可选限定仓库)',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '请求路径(如:/api/users)' },
          repositoryId: { type: 'string', description: '仓库 ID(可选,传入字符串)' },
        },
        required: ['path'],
      },
    },
  • Core helper method in Rap2Client class that implements the tool logic: builds query params for 'path' and optional 'repositoryId', performs HTTP fetch to the RAP2 /interface/search endpoint, and processes the response handling errors.
    async searchInterfacesByPath(path, repositoryId) {
      const params = new URLSearchParams({ path: String(path || '') });
      if (repositoryId) params.set('repositoryId', String(repositoryId));
      const res = await this._fetch(`/interface/search?${params.toString()}`);
      const body = res?.data || {};
      if (body.errMsg) return { error: body.errMsg };
      return body.data || [];
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers almost none. It doesn't describe what 'search' entails (e.g., exact match, partial match, case sensitivity), what the output looks like, pagination behavior, error conditions, or authentication requirements. The description merely restates the tool name with slight elaboration, failing to compensate for the lack of annotations.

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 extremely concise - a single sentence in Chinese that directly states the function. There's no wasted text or unnecessary elaboration. However, the brevity comes at the cost of completeness, as it lacks important contextual information that would help an agent use the tool effectively.

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 2 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what constitutes a successful search, what format results return, how many results to expect, or error handling. The agent would struggle to understand the tool's behavior beyond the basic parameter requirements documented in the schema.

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 thoroughly. The description adds no additional meaning beyond what's in the schema - it mentions 'request path' and 'optional repository limitation' which are already covered by parameter descriptions. This meets the baseline for high schema coverage where the description doesn't need to compensate.

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 as 'search interfaces by request path' with optional repository limitation. It specifies both the verb ('search') and resource ('interfaces'), making the function understandable. However, it doesn't explicitly differentiate from sibling tools like 'rap2_search_interfaces_by_keyword' which suggests similar search functionality with different parameters.

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 minimal guidance, only mentioning the optional repository limitation. It doesn't indicate when to use this tool versus alternatives like 'rap2_search_interfaces_by_keyword' or 'rap2_get_repository_interfaces', nor does it specify prerequisites, success conditions, or error scenarios. The agent receives no contextual decision-making help.

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/MarveleE/rap2-mcp'

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