fakestore_get_categories
Retrieve all product categories from the Fake Store API to organize and filter e-commerce data for demos, testing, or learning purposes.
Instructions
Get all available product categories
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/products.ts:38-43 (handler)The core handler function that fetches and returns the list of product categories from the FakeStore API endpoint '/products/categories'./** * Get all product categories */ export async function getCategories(): Promise<string[]> { return get<string[]>('/products/categories'); }
- src/tools/products.ts:164-171 (schema)The tool schema definition, specifying the name, description, and empty input schema (no parameters required). This is part of the productTools array used for tool listing.{ name: 'fakestore_get_categories', description: 'Get all available product categories', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:68-73 (registration)The registration and dispatch logic in the main tool call handler. Matches the tool name and invokes the getCategories handler, formatting the result as JSON text response.if (name === 'fakestore_get_categories') { const result = await getCategories(); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }