unfollow_user
Stop following a specific user on Qiita by providing their user ID. This action removes them from your following list on the Japanese developer community platform.
Instructions
指定されたユーザーのフォローを解除します
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"userId": "<userId>"
},
"name": "unfollow_user"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | ユーザーID |
Implementation Reference
- src/tools/handlers.ts:157-160 (handler)The handler for the 'unfollow_user' tool. It validates input using userIdSchema and executes by calling unfollowUser on the QiitaApiClient instance.
unfollow_user: { schema: userIdSchema, execute: async ({ userId }, client) => client.unfollowUser(userId), }, - src/tools/definitions.ts:479-491 (schema)The MCP tool schema definition for 'unfollow_user', including name, description, and input schema, used for tool listing.
name: 'unfollow_user', description: '指定されたユーザーのフォローを解除します', inputSchema: { type: 'object', properties: { userId: { type: 'string', description: 'ユーザーID', }, }, required: ['userId'], }, }, - src/qiitaApiClient.ts:200-204 (helper)The core helper function implementing the unfollow logic by sending a DELETE request to the Qiita API.
async unfollowUser(userId: string) { this.assertAuthenticated(); await this.client.delete(`/users/${userId}/following`); return { success: true }; } - src/index.ts:30-65 (registration)Server request handler for calling tools, which looks up the handler by name from toolHandlers and executes it with a QiitaApiClient instance.
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)Server request handler for listing tools, returning the tools array which includes the unfollow_user definition.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });