search_items
Search Qiita articles with a query or get recent articles to find technical content and documentation.
Instructions
Search Qiita articles. You can search with a query string or get recent articles without a query.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Search query (optional) | |
| page | No | Page number (1-100, default: 1) | |
| per_page | No | Items per page (1-100, default: 20) |
Implementation Reference
- src/index.ts:313-322 (handler)Handles the execution of the 'search_items' tool in the MCP call handler by invoking qiitaClient.searchItems with input arguments and returning the result as formatted JSON text.case "search_items": { const result = await qiitaClient.searchItems( args?.query as string | undefined, args?.page as number | undefined, args?.per_page as number | undefined ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
- src/index.ts:130-150 (schema)Defines the input JSON schema for the 'search_items' tool, specifying optional query, page, and per_page parameters with validation.inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query (optional)", }, page: { type: "number", description: "Page number (1-100, default: 1)", minimum: 1, maximum: 100, }, per_page: { type: "number", description: "Items per page (1-100, default: 20)", minimum: 1, maximum: 100, }, }, },
- src/index.ts:126-151 (registration)Registers the 'search_items' tool in the tools array, including name, description, and input schema, used by the ListTools handler.{ name: "search_items", description: "Search Qiita articles. You can search with a query string or get recent articles without a query.", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query (optional)", }, page: { type: "number", description: "Page number (1-100, default: 1)", minimum: 1, maximum: 100, }, per_page: { type: "number", description: "Items per page (1-100, default: 20)", minimum: 1, maximum: 100, }, }, }, },
- src/index.ts:45-60 (helper)Core helper function in QiitaClient that constructs the API request parameters and fetches search results from Qiita's /items endpoint.async searchItems( query?: string, page: number = 1, perPage: number = 20 ): Promise<any[]> { const params = new URLSearchParams({ page: page.toString(), per_page: perPage.toString(), }); if (query) { params.append("query", query); } return this.fetch(`/items?${params.toString()}`); }