get_user_stocks
Retrieve a user's stock list from Qiita to access their saved articles. Specify user ID and pagination to browse collected content efficiently.
Instructions
指定されたユーザーのストック一覧を取得します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | ページ番号(1-100) | |
| perPage | No | 1ページあたりの件数(1-100) | |
| userId | Yes | ユーザーID |
Implementation Reference
- src/tools/handlers.ts:70-74 (handler)Handler definition for the 'get_user_stocks' tool. It defines the Zod input schema by merging userId and pagination schemas, and provides the execute function that calls the QiitaApiClient's getUserStocks method.get_user_stocks: { schema: userIdSchema.merge(paginationSchema), execute: async ({ userId, page, perPage }, client) => client.getUserStocks(userId, page, perPage), },
- src/tools/definitions.ts:71-94 (schema)MCP tool schema definition for 'get_user_stocks', specifying the name, description, and input schema with required userId and optional pagination parameters.{ name: 'get_user_stocks', description: '指定されたユーザーのストック一覧を取得します', inputSchema: { type: 'object', properties: { userId: { type: 'string', description: 'ユーザーID', }, page: { type: 'number', description: 'ページ番号(1-100)', default: 1, }, perPage: { type: 'number', description: '1ページあたりの件数(1-100)', default: 20, }, }, required: ['userId'], }, },
- src/qiitaApiClient.ts:43-48 (helper)Core implementation in QiitaApiClient that makes the HTTP GET request to Qiita API endpoint /users/{userId}/stocks to retrieve the user's stocks list.async getUserStocks(userId: string, page = 1, perPage = 20) { const response = await this.client.get(`/users/${userId}/stocks`, { params: { page, per_page: perPage }, }); return response.data; }