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

fakestore_add_user

Add a new user to the Fake Store API for testing or demonstration purposes. This simulation tool accepts user details like email, username, address, and contact information.

Instructions

Add a new user (simulation - does not persist)

Input Schema

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

Implementation Reference

  • Core handler function 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, }); }
  • Input schema definition for the fakestore_add_user tool, specifying properties, types, descriptions, and required fields.
    { 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 invokes the addUser function when the tool name matches.
    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:42-42 (registration)
    Tool list registration where userTools (including fakestore_add_user schema) is combined and returned in ListToolsRequestSchema handler.
    tools: [...productTools, ...cartTools, ...userTools],
  • src/index.ts:20-20 (registration)
    Import statement that brings in the addUser handler and userTools (with schema) from users.ts.
    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