create_user
Create new user accounts in PocketBase databases by providing email, password, and user details for authentication setup.
Instructions
Create a new user account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | User email | ||
| password | Yes | User password | |
| passwordConfirm | Yes | Password confirmation | |
| name | No | User name | |
| collection | No | Collection name (default: users) | users |
Implementation Reference
- src/index.ts:911-934 (handler)The handler function that executes the create_user tool. It creates a new user in the specified PocketBase collection using the pb.collection().create() method with the provided arguments.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 definition for the create_user tool, specifying properties and required fields.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:546-576 (registration)Tool registration in the ListTools response, including name, description, and reference to inputSchema.{ 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)Dispatch/registration case in the CallToolRequest handler that routes to the createUser method.case 'create_user': return await this.createUser(request.params.arguments);