Skip to main content
Glama

fakestore_add_user

Add a new user to the Fake Store API for testing and demonstration purposes. This simulation accepts user details including email, username, address, and contact information without persisting data.

Instructions

Add a new user (simulation - does not persist)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYesCity
emailYesUser email address
firstnameYesFirst name
lastnameYesLast name
latYesLatitude
longYesLongitude
numberYesStreet number
passwordYesUser password
phoneYesPhone number
streetYesStreet name
usernameYesUsername
zipcodeYesZIP code

Implementation Reference

  • The core handler function `addUser` that validates input parameters and sends a POST request to the FakeStore API to simulate adding a new user.
    export async function addUser(args: { email: string; username: string; password: string; firstname: string; lastname: string; city: string; street: string; number: number; zipcode: string; lat: string; long: string; phone: string; }): Promise<User> { const { email, username, password, firstname, lastname, city, street, number, zipcode, lat, long, phone, } = args; // Basic validation validateEmail(email); validatePhone(phone); if (!username || typeof username !== 'string') { throw new Error('Username must be a non-empty string'); } if (!password || typeof password !== 'string') { throw new Error('Password must be a non-empty string'); } if (!firstname || typeof firstname !== 'string') { throw new Error('First name must be a non-empty string'); } if (!lastname || typeof lastname !== 'string') { throw new Error('Last name must be a non-empty string'); } return post<User>('/users', { email, username, password, name: { firstname, lastname, }, address: { city, street, number, zipcode, geolocation: { lat, long, }, }, phone, }); }
  • The tool schema definition including name, description, and detailed inputSchema with properties and required fields for the fakestore_add_user tool.
    { name: 'fakestore_add_user', description: 'Add a new user (simulation - does not persist)', inputSchema: { type: 'object', properties: { email: { type: 'string', description: 'User email address', }, username: { type: 'string', description: 'Username', }, password: { type: 'string', description: 'User password', }, firstname: { type: 'string', description: 'First name', }, lastname: { type: 'string', description: 'Last name', }, city: { type: 'string', description: 'City', }, street: { type: 'string', description: 'Street name', }, number: { type: 'number', description: 'Street number', }, zipcode: { type: 'string', description: 'ZIP code', }, lat: { type: 'string', description: 'Latitude', }, long: { type: 'string', description: 'Longitude', }, phone: { type: 'string', description: 'Phone number', }, }, required: ['email', 'username', 'password', 'firstname', 'lastname', 'city', 'street', 'number', 'zipcode', 'lat', 'long', 'phone'], }, },
  • src/index.ts:183-201 (registration)
    Registration and dispatch logic in the main CallToolRequestSchema handler that maps the tool name to the addUser function execution and formats the response.
    if (name === 'fakestore_add_user') { const result = await addUser(args as { email: string; username: string; password: string; firstname: string; lastname: string; city: string; street: string; number: number; zipcode: string; lat: string; long: string; phone: string; }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • src/index.ts:40-44 (registration)
    Tool listing registration where userTools (containing fakestore_add_user) is included in the list of available tools.
    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