Skip to main content
Glama
MarveleE
by MarveleE

rap2_get_repository_interfaces

Retrieve all interface lists from a specified repository in RAP2 API documentation to access and manage API endpoints efficiently.

Instructions

获取仓库下的全部接口列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repositoryIdYes仓库 ID(传入字符串)

Implementation Reference

  • Core implementation: Fetches the repository by ID, extracts modules, and flattens all interfaces.
    async getRepositoryInterfaces(repositoryId) {
      const res = await this._fetch(`/repository/get?id=${encodeURIComponent(repositoryId)}`);
      const body = res?.data || {};
      if (body.errMsg) return { error: body.errMsg };
      const repo = body.data || {};
      const modules = Array.isArray(repo.modules) ? repo.modules : [];
      const interfaces = modules.flatMap(m => Array.isArray(m.interfaces) ? m.interfaces : []);
      return interfaces;
    }
  • MCP server tool handler: Normalizes input, calls Rap2Client.getRepositoryInterfaces, handles errors, and formats response.
    if (name === 'rap2_get_repository_interfaces') {
      const { repositoryId } = (req.params.arguments || {});
      const normalizedId = validateAndNormalizeId('repositoryId', repositoryId);
    
      const client = createClient();
      const result = await client.getRepositoryInterfaces(normalizedId);
    
      if (result?.error) {
        const errorMsg = String(result.error);
        logger.error({ tool: name, repositoryId: normalizedId, error: errorMsg }, 'tool failed');
        throw new Error(`获取仓库接口失败: ${errorMsg}`);
      }
    
      logger.info({ tool: name, repositoryId: normalizedId, resultCount: Array.isArray(result) ? result.length : 0 }, 'tool success');
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
  • Tool schema definition including input schema for repositoryId.
    {
      name: 'rap2_get_repository_interfaces',
      description: '获取仓库下的全部接口列表',
      inputSchema: {
        type: 'object',
        properties: {
          repositoryId: { type: 'string', description: '仓库 ID(传入字符串)' },
        },
        required: ['repositoryId'],
      },
    },
  • Server initialization registering the tools list which includes this tool.
    const server = new Server(
      { name: 'rap2-mcp-tool', version: '0.1.9' },
      { capabilities: { tools: { list: 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