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
| Name | Required | Description | Default |
|---|---|---|---|
| repositoryId | Yes | 仓库 ID(传入字符串) |
Implementation Reference
- src/rap2Client.js:173-181 (handler)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; }
- src/mcp-server.js:228-242 (handler)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) }] };
- src/mcp-server.js:129-139 (schema)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'], }, },
- src/mcp-server.js:166-168 (registration)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 } } },