Skip to main content
Glama

stock_item

Save articles to your Qiita stock list for later reading and reference by providing the article ID.

Instructions

指定された記事をストックします

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemIdYes記事ID

Implementation Reference

  • Handler for the 'stock_item' MCP tool. Defines the Zod input schema and execute function that calls QiitaApiClient.stockItem with the itemId.
    stock_item: { schema: itemIdSchema, execute: async ({ itemId }, client) => client.stockItem(itemId), },
  • MCP tool schema definition for 'stock_item', used in ListTools response. Specifies input schema requiring 'itemId'.
    { name: 'stock_item', description: '指定された記事をストックします', inputSchema: { type: 'object', properties: { itemId: { type: 'string', description: '記事ID', }, }, required: ['itemId'], }, },
  • Core implementation in QiitaApiClient that authenticates and sends PUT request to Qiita API endpoint /items/{itemId}/stock to stock the item.
    async stockItem(itemId: string) { this.assertAuthenticated(); await this.client.put(`/items/${itemId}/stock`); return { success: true }; }
  • src/index.ts:30-65 (registration)
    MCP server request handler for CallToolRequestSchema, which looks up the handler by name from toolHandlers, parses args, executes the tool handler with Qiita client, and returns result as text.
    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/index.ts:26-28 (registration)
    MCP server request handler for ListToolsRequestSchema, which returns the array of tool definitions including 'stock_item' schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });

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