Skip to main content
Glama
Myk3rinos

MCP Personal Tools Server

by Myk3rinos

create-user

Add new user records to the database with required personal details including name, email, address, phone, and password.

Instructions

Create a new user in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
emailYes
addressYes
phoneYes
passwordYes

Implementation Reference

  • src/server.ts:64-87 (registration)
    Registration of the 'create-user' tool, including input schema, hints, and inline handler function.
    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` }]
            }    
        }  
    })
  • Core handler logic for creating a user: loads users from JSON, appends new user, writes back to file, returns 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;
    }
  • Input schema for the create-user tool, validated with Zod.
        name: z.string(),
        email: z.string().email(),
        address: z.string(),
        phone: z.string(),
        password: z.string(),
    }, {
  • Inline handler function passed to server.tool for create-user, handles error and success responses.
    }, 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` }]
            }    
        }  
    })
Install Server

Other 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