get_qiita_item
Retrieve a specific Qiita article using its unique ID to access detailed content. Enables efficient article lookup for streamlined information retrieval.
Instructions
get a specific Qiita article by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item_id | Yes | The ID of the Qiita article to fetch |
Implementation Reference
- src/tools/qiitaTools.ts:51-60 (handler)The main handler function for the 'get_qiita_item' tool. It extracts the item_id from params, fetches the item using QiitaApiService, formats it as JSON in a success response, or returns an error response.const getQiitaItem = async (params: GetItemParams): Promise<any> => { try { const { item_id } = params; const item = await apiService.getItem(item_id); return createSuccessResponse(JSON.stringify(item, null, 2)); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return createErrorResponse(`Error fetching Qiita item: ${errorMessage}`); } };
- src/tools/qiitaTools.ts:46-49 (schema)Zod input schema for the tool, defining the required 'item_id' string parameter.const getItemSchema = z.object({ item_id: z.string().describe("The ID of the Qiita article to fetch"), }); type GetItemParams = z.infer<typeof getItemSchema>;
- src/tools/qiitaTools.ts:137-142 (registration)Tool definition registration within getToolDefinitions() array, providing name, description, schema.shape as parameters, and wrapper handler.{ name: "get_qiita_item", description: "get a specific Qiita article by its ID", parameters: getItemSchema.shape, handler: (params: GetItemParams) => getQiitaItem(params) },
- src/index.ts:19-21 (registration)MCP server registration loop that registers all tools from qiitaTools.getToolDefinitions(), including 'get_qiita_item'.getToolDefinitions().forEach(({ name, description, parameters, handler }) => { server.tool(name, description, parameters, handler); });
- src/services/qiita.ts:129-143 (helper)Core API helper method in QiitaApiService that fetches the specific Qiita item by ID via HTTP GET, validates token, handles errors, filters response fields to reduce tokens.getItem = async (item_id: string): Promise<any> => { this.validateToken(); const response = await fetch( `${this.baseUrl}/items/${item_id}`, { headers: this.getHeaders() } ); if (!response.ok) { await this.handleErrorResponse(response); } const item = await response.json(); return this.filterItem(item); };