unstock_item
Remove an article from your Qiita stock list to manage your saved content by providing the article ID.
Instructions
指定された記事のストックを解除します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemId | Yes | 記事ID |
Implementation Reference
- src/tools/handlers.ts:112-115 (handler)The MCP tool handler for 'unstock_item'. It validates input using itemIdSchema and delegates execution to QiitaApiClient.unstockItem(itemId).unstock_item: { schema: itemIdSchema, execute: async ({ itemId }, client) => client.unstockItem(itemId), },
- src/tools/definitions.ts:306-319 (schema)The input schema and metadata definition for the 'unstock_item' tool used in MCP tool listing.{ name: 'unstock_item', description: '指定された記事のストックを解除します', inputSchema: { type: 'object', properties: { itemId: { type: 'string', description: '記事ID', }, }, required: ['itemId'], }, },
- src/qiitaApiClient.ts:111-115 (helper)The core implementation of unstocking an item: authenticates, sends DELETE to Qiita API /items/{itemId}/stock, returns success.async unstockItem(itemId: string) { this.assertAuthenticated(); await this.client.delete(`/items/${itemId}/stock`); return { success: true }; }
- src/index.ts:30-65 (registration)The tool call request handler registration, which dynamically dispatches to the appropriate handler (including unstock_item) based on name, using toolHandlers map.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const accessToken = process.env.QIITA_ACCESS_TOKEN; const qiita = new QiitaApiClient(accessToken); const handler = toolHandlers[name]; try { if (!handler) { throw new Error(`未知のツール: ${name}`); } const parsedArgs = handler.schema.parse(args ?? {}); const result = await handler.execute(parsedArgs, qiita); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error: any) { const message = error?.message ?? String(error); return { content: [ { type: 'text', text: `エラーが発生しました: ${message}`, }, ], isError: true, }; } });
- src/tools/handlers.ts:19-21 (schema)Shared Zod schema for itemId input, used by unstock_item and other item-related tools.const itemIdSchema = z.object({ itemId: z.string(), });