Skip to main content
Glama

fakestore_get_user

Retrieve user details by ID from the Fake Store API to access customer information for e-commerce applications, testing, and development.

Instructions

Get a single user by their ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUser ID

Implementation Reference

  • Core handler function that fetches and returns a single user by ID from the FakeStore API after validating the ID.
    export async function getUserById(args: { id: number }): Promise<User> { const { id } = args; validatePositiveInteger(id, 'User ID'); return get<User>(`/users/${id}`); }
  • Tool schema definition including name, description, and input schema for validating the 'id' parameter.
    { name: 'fakestore_get_user', description: 'Get a single user by their ID', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'User ID', }, }, required: ['id'], }, },
  • src/index.ts:176-181 (registration)
    Dispatch logic in the main CallToolRequestSchema handler that routes fakestore_get_user calls to the getUserById function.
    if (name === 'fakestore_get_user') { const result = await getUserById(args as { id: number }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • src/index.ts:40-44 (registration)
    Registration of all tools, including userTools containing fakestore_get_user, for the ListToolsRequestSchema endpoint.
    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