get_user_stocks
Retrieve a user's saved articles from Qiita by providing their user ID, with options to paginate results for efficient browsing.
Instructions
指定されたユーザーのストック一覧を取得します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | ユーザーID | |
| page | No | ページ番号(1-100) | |
| perPage | No | 1ページあたりの件数(1-100) |
Implementation Reference
- src/tools/handlers.ts:70-74 (handler)Handler definition for the 'get_user_stocks' tool. It defines the Zod schema by merging userId and pagination schemas, and provides an execute function that calls the QiitaApiClient's getUserStocks method with the parsed input.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 definition for 'get_user_stocks', including the name, description, and inputSchema specifying parameters: userId (required string), page and perPage (optional numbers with defaults).{ 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 of getUserStocks in QiitaApiClient class. Makes an authenticated GET request to Qiita API endpoint /users/{userId}/stocks with pagination params and returns the response data.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; }