Skip to main content
Glama
Myk3rinos

MCP Personal Tools Server

by Myk3rinos

create-user

Add a new user to the database by providing name, email, address, phone, and password. Designed for the MCP Personal Tools Server to manage user accounts efficiently.

Instructions

Create a new user in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes
emailYes
nameYes
passwordYes
phoneYes

Implementation Reference

  • The handler function for the 'create-user' tool. It calls the createUser helper function and returns a success or error message.
    }, async (params) => { try { const id = await createUser(params); return { content: [{ type: "text", text: `User ${params.name} with id ${id} created successfully` }] } } catch (error) { return { content: [{ type: "text", text: `User ${params.name} creation failed` }] } } })
  • Input schema using Zod for validating parameters: name, email, address, phone, password.
    name: z.string(), email: z.string().email(), address: z.string(), phone: z.string(), password: z.string(), }, {
  • src/server.ts:64-87 (registration)
    Registration of the 'create-user' tool with the MCP server, including description, input schema, hints, and handler.
    server.tool("create-user","Create a new user in the database", { name: z.string(), email: z.string().email(), address: z.string(), phone: z.string(), password: z.string(), }, { title: "Create User", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true, }, async (params) => { try { const id = await createUser(params); return { content: [{ type: "text", text: `User ${params.name} with id ${id} created successfully` }] } } catch (error) { return { content: [{ type: "text", text: `User ${params.name} creation failed` }] } } })
  • Helper function that loads users from JSON, appends a new user with incremented ID, writes back to file, and returns the new ID.
    async function createUser(user: {name: string, email: string, address: string, phone: string, password: string }) { const users = await import("./data/users.json", { with: {type: "json" }, }).then((module) => module.default); const id = users.length + 1; users.push({ id, ...user }); await fs.writeFile("./src/data/users.json", JSON.stringify(users, null, 2)); return id; }

Other Tools

Related Tools

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/Myk3rinos/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server