follow_tag
Subscribe to specific tags on Qiita to receive updates and discover relevant developer content in your feed.
Instructions
指定されたタグをフォローします
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tagId | Yes | タグID |
Implementation Reference
- src/tools/handlers.ts:141-144 (handler)The handler for the 'follow_tag' tool. It uses tagIdSchema for input validation and delegates execution to QiitaApiClient.followTag(tagId).follow_tag: { schema: tagIdSchema, execute: async ({ tagId }, client) => client.followTag(tagId), },
- src/tools/definitions.ts:422-435 (schema)MCP tool definition for 'follow_tag' including the input JSON schema requiring a 'tagId' string.{ name: 'follow_tag', description: '指定されたタグをフォローします', inputSchema: { type: 'object', properties: { tagId: { type: 'string', description: 'タグID', }, }, required: ['tagId'], }, },
- src/index.ts:26-28 (registration)Registration of the tool list request handler, which returns the tools array containing 'follow_tag'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
- src/index.ts:30-65 (registration)Registration of the call tool request handler, which dynamically dispatches to toolHandlers[name].execute for 'follow_tag'.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/qiitaApiClient.ts:156-160 (helper)The QiitaApiClient method that performs the actual API call to follow the specified tag.async followTag(tagId: string) { this.assertAuthenticated(); await this.client.put(`/tags/${tagId}/following`); return { success: true }; }