Skip to main content
Glama
op-enny
by op-enny

fakestore_get_users

Retrieve user data from the Fake Store API for testing or development. Filter results with limit and sort parameters to manage e-commerce user information.

Instructions

Get all users from the store. Optionally limit results and sort.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoLimit the number of users returned
sortNoSort users (asc or desc)

Implementation Reference

  • Core handler function that fetches users from the FakeStore API with optional limit and sort parameters. Performs input validation and constructs query parameters.
    export async function getAllUsers(args: { limit?: number; sort?: SortOrder }): Promise<User[]> { const { limit, sort } = args; if (limit !== undefined) { validateLimit(limit); } if (sort !== undefined) { validateSortOrder(sort); } const params: Record<string, unknown> = {}; if (limit) params.limit = limit; if (sort) params.sort = sort; return get<User[]>('/users', params); }
  • Input schema definition for the fakestore_get_users tool, including properties for limit and sort.
    { name: 'fakestore_get_users', description: 'Get all users from the store. Optionally limit results and sort.', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Limit the number of users returned', }, sort: { type: 'string', enum: ['asc', 'desc'], description: 'Sort users (asc or desc)', }, }, }, },
  • MCP tool call handler that dispatches to getAllUsers and formats the JSON response.
    if (name === 'fakestore_get_users') { const result = await getAllUsers(args as { limit?: number; sort?: 'asc' | 'desc' }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], };
  • src/index.ts:40-44 (registration)
    Registers all tools including userTools (with fakestore_get_users) for the ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [...productTools, ...cartTools, ...userTools], }; });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/op-enny/mcp-server-fakestore'

If you have feedback or need assistance with the MCP directory API, please join our Discord server