create_user
Generate new user accounts with specified email, password, name, and optional collection in PocketBase MCP Server. Simplify user management and database integration using structured input data.
Instructions
Create a new user account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | No | Collection name (default: users) | users |
| Yes | User email | ||
| name | No | User name | |
| password | Yes | User password | |
| passwordConfirm | Yes | Password confirmation |
Implementation Reference
- src/index.ts:911-934 (handler)The handler function that executes the create_user tool by creating a new user record in the specified PocketBase collection using the PocketBase SDK.private async createUser(args: any) { try { const collection = args.collection || 'users'; const result = await this.pb.collection(collection).create({ email: args.email, password: args.password, passwordConfirm: args.passwordConfirm, name: args.name, }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error: unknown) { throw new McpError( ErrorCode.InternalError, `Failed to create user: ${pocketbaseErrorMessage(error)}` ); } }
- src/index.ts:549-575 (schema)Input schema defining the parameters for the create_user tool: required email, password, passwordConfirm; optional name and collection.inputSchema: { type: 'object', properties: { email: { type: 'string', description: 'User email', }, password: { type: 'string', description: 'User password', }, passwordConfirm: { type: 'string', description: 'Password confirmation', }, name: { type: 'string', description: 'User name', }, collection: { type: 'string', description: 'Collection name (default: users)', default: 'users' } }, required: ['email', 'password', 'passwordConfirm'], },
- src/index.ts:547-576 (registration)Tool registration in the MCP server's list of tools, including name, description, and input schema.name: 'create_user', description: 'Create a new user account', inputSchema: { type: 'object', properties: { email: { type: 'string', description: 'User email', }, password: { type: 'string', description: 'User password', }, passwordConfirm: { type: 'string', description: 'Password confirmation', }, name: { type: 'string', description: 'User name', }, collection: { type: 'string', description: 'Collection name (default: users)', default: 'users' } }, required: ['email', 'password', 'passwordConfirm'], }, },
- src/index.ts:685-686 (registration)Dispatcher case in the CallToolRequestHandler that routes 'create_user' calls to the createUser method.case 'create_user': return await this.createUser(request.params.arguments);