Skip to main content
Glama

fakestore_get_users

Retrieve user data from the Fake Store API with optional filtering and sorting capabilities for e-commerce testing and development.

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 implementing the fakestore_get_users tool logic: validates optional limit and sort parameters, constructs query params, and calls the API to fetch users.
    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 within the userTools array.
    { 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)', }, }, }, },
  • src/index.ts:40-44 (registration)
    Tool registration in MCP list tools handler; includes userTools which contains fakestore_get_users.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [...productTools, ...cartTools, ...userTools], }; });
  • Dispatch handler in MCP call tool request that invokes getAllUsers for fakestore_get_users and formats 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:20-20 (registration)
    Import of userTools (with schema/registration) and getAllUsers (handler) from users module.
    import { userTools, getAllUsers, getUserById, addUser, updateUser, deleteUser } from './tools/users.js';

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