is_item_stocked
Check if a Qiita article is stocked by users to monitor content popularity and engagement on the Japanese developer platform.
Instructions
指定された記事がストックされているかどうかを確認します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemId | Yes | 記事ID |
Implementation Reference
- src/tools/handlers.ts:116-119 (handler)The handler function for the 'is_item_stocked' tool. It uses itemIdSchema for validation and delegates execution to the QiitaApiClient's isItemStocked method.is_item_stocked: { schema: itemIdSchema, execute: async ({ itemId }, client) => client.isItemStocked(itemId), },
- src/tools/definitions.ts:320-333 (schema)The schema definition for the 'is_item_stocked' tool, including name, description, and input schema used for MCP tool listing.{ name: 'is_item_stocked', description: '指定された記事がストックされているかどうかを確認します', inputSchema: { type: 'object', properties: { itemId: { type: 'string', description: '記事ID', }, }, required: ['itemId'], }, },
- src/qiitaApiClient.ts:117-128 (helper)The core helper method in QiitaApiClient that implements the stock check logic by attempting a GET request to the stock endpoint and interpreting 404 as not stocked.async isItemStocked(itemId: string) { this.assertAuthenticated(); try { await this.client.get(`/items/${itemId}/stock`); return { stocked: true }; } catch (error: any) { if (error.response?.status === 404) { return { stocked: false }; } throw error; } }