|
| 1 | +--- |
| 2 | +name: implement-backlog-api-tool |
| 3 | +description: Implements a new MCP tool for a Backlog API endpoint from its documentation URL (e.g. https://developer.nulab.com/docs/backlog/api/2/get-space/). Use this skill when you need to add or update a tool in this MCP server based on a Backlog API spec. |
| 4 | +--- |
| 5 | + |
| 6 | +# Implement a Backlog API Tool |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +Implement a new MCP tool for the Backlog API endpoint documented at $ARGUMENTS. |
| 11 | + |
| 12 | +## Steps |
| 13 | + |
| 14 | +### 1. Read the API spec |
| 15 | + |
| 16 | +Fetch the documentation page using the `fetch_webpage` tool with the URL `$ARGUMENTS` and extract the following: |
| 17 | + |
| 18 | +Identify: |
| 19 | + |
| 20 | +- **HTTP Method** – `GET`, `POST`, `PATCH`, `DELETE`, etc. |
| 21 | +- **Endpoint path** – e.g. `/api/v2/space` |
| 22 | +- **Parameters** – name, type, required/optional, description |
| 23 | +- **Response fields** – JSON structure returned by the API |
| 24 | + |
| 25 | +### 2. Check the backlog-js client |
| 26 | + |
| 27 | +Find the corresponding method in the `backlog-js` type definitions: |
| 28 | + |
| 29 | +```bash |
| 30 | +grep "methodName" node_modules/backlog-js/dist/types/backlog.d.ts |
| 31 | +``` |
| 32 | + |
| 33 | +Replace `methodName` with the actual method name (e.g. `getSpace`, `postIssue`). If unsure of the name, read the full file to browse all available methods: |
| 34 | + |
| 35 | +```bash |
| 36 | +cat node_modules/backlog-js/dist/types/backlog.d.ts |
| 37 | +``` |
| 38 | + |
| 39 | +Use the method's name and type signature as the basis for implementation. |
| 40 | + |
| 41 | +### 3. Read an existing similar tool for reference |
| 42 | + |
| 43 | +```bash |
| 44 | +cat src/tools/getSpace.ts |
| 45 | +cat src/handlers/builders/composeToolHandler.ts |
| 46 | +``` |
| 47 | + |
| 48 | +### 4. Implement the tool |
| 49 | + |
| 50 | +Create or update these files following the existing patterns: |
| 51 | + |
| 52 | +#### `src/tools/<toolName>.ts` |
| 53 | + |
| 54 | +- Define the tool name, description, and input schema using `zod` |
| 55 | +- Map each API parameter to a zod field with an appropriate description |
| 56 | +- Set `outputSchema` to a Zod schema matching the API response shape (see `src/types/zod/backlogOutputDefinition.ts`) |
| 57 | +- Set `importantFields` to the subset of fields that are most relevant to the user |
| 58 | +- Implement `handler` to call the corresponding `backlog-js` client method |
| 59 | + |
| 60 | +#### `src/tools/tools.ts` |
| 61 | + |
| 62 | +- Register the new tool so it is picked up by the server |
0 commit comments