Skip to main content
Glama

is_item_stocked

Check if a specific Qiita article has been stocked by users to monitor content popularity and engagement on the Japanese developer platform.

Instructions

指定された記事がストックされているかどうかを確認します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemIdYes記事ID

Implementation Reference

  • The handler definition for the 'is_item_stocked' tool. It uses itemIdSchema for input validation and delegates execution to the QiitaApiClient's isItemStocked method.
    is_item_stocked: { schema: itemIdSchema, execute: async ({ itemId }, client) => client.isItemStocked(itemId), },
  • MCP tool definition providing the name, description, and input schema for 'is_item_stocked' used in ListTools response.
    { name: 'is_item_stocked', description: '指定された記事がストックされているかどうかを確認します', inputSchema: { type: 'object', properties: { itemId: { type: 'string', description: '記事ID', }, }, required: ['itemId'], }, },
  • Core logic implementation in QiitaApiClient that checks if the item is stocked by the authenticated user via a GET request to the stock endpoint, 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; } }
  • src/index.ts:30-65 (registration)
    MCP server request handler for CallToolRequestSchema that retrieves the handler from toolHandlers by name, parses arguments, executes the handler, and returns the result.
    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, }; } });

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/Selenium39/mcp-server-qiita'

If you have feedback or need assistance with the MCP directory API, please join our Discord server