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

fakestore_get_user

Retrieve user details by ID from the Fake Store API to access e-commerce user information for testing or development purposes.

Instructions

Get a single user by their ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUser ID

Implementation Reference

  • Core handler function that validates the user ID and fetches the user data from the FakeStore API endpoint `/users/${id}`.
    export async function getUserById(args: { id: number }): Promise<User> {
      const { id } = args;
      validatePositiveInteger(id, 'User ID');
      return get<User>(`/users/${id}`);
    }
  • Input schema definition for the tool, specifying the required 'id' parameter as a number.
    {
      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)
    Tool dispatch registration in the main MCP CallToolRequestSchema handler, which calls the getUserById function and formats the response.
    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 tool list including userTools (which contains fakestore_get_user schema) for ListToolsRequestSchema.
    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