matomo_add_user
Add a new user to Matomo Analytics by specifying login name, email, password, and optional alias. Facilitates user management through the Matomo MCP Server.
Instructions
Thêm một user mới vào Matomo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alias | No | Bí danh của user (tùy chọn) | |
| Yes | Email của user | ||
| password | Yes | Mật khẩu của user | |
| userLogin | Yes | Tên đăng nhập của user |
Implementation Reference
- src/index.ts:111-136 (schema)Input schema and tool definition for 'matomo_add_user' in the list of tools returned by ListToolsRequestSchema.{ name: 'matomo_add_user', description: 'Thêm một user mới vào Matomo', inputSchema: { type: 'object', properties: { userLogin: { type: 'string', description: 'Tên đăng nhập của user', }, email: { type: 'string', description: 'Email của user', }, password: { type: 'string', description: 'Mật khẩu của user', }, alias: { type: 'string', description: 'Bí danh của user (tùy chọn)', }, }, required: ['userLogin', 'email', 'password'], }, },
- src/index.ts:268-269 (registration)Dispatch case in CallToolRequestSchema handler that routes to the tool's handler function.case 'matomo_add_user': return await this.handleAddUser(args as { userLogin: string; email: string; password: string; alias?: string });
- src/index.ts:394-407 (handler)MCP tool handler function that validates connection and delegates to MatomoApiService.addUser.private async handleAddUser(args: { userLogin: string; email: string; password: string; alias?: string }) { if (!this.matomoService) { throw new Error('Chưa kết nối đến Matomo. Vui lòng sử dụng matomo_connect trước.'); } await this.matomoService.addUser(args.userLogin, args.email, args.password, args.alias); return { content: [ { type: 'text', text: `Đã thêm user thành công: ${args.userLogin}`, }, ], };
- src/services/matomo-api.ts:78-83 (handler)Core implementation that makes the API request to Matomo's UsersManager.addUser endpoint.async addUser(userLogin: string, email: string, password: string, alias?: string): Promise<void> { const params: any = { userLogin, email, password }; if (alias) params.alias = alias; await this.makeRequest('UsersManager.addUser', params); }