matomo_add_user
Add a new user to Matomo Analytics by providing login credentials and email, enabling 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 |
|---|---|---|---|
| userLogin | Yes | Tên đăng nhập của user | |
| Yes | Email của user | ||
| password | Yes | Mật khẩu của user | |
| alias | No | Bí danh của user (tùy chọn) |
Implementation Reference
- src/index.ts:111-136 (schema)Input schema and description for the matomo_add_user tool, registered in ListTools response{ 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)Tool registration in the CallToolRequestHandler switch statement, dispatching to handleAddUsercase 'matomo_add_user': return await this.handleAddUser(args as { userLogin: string; email: string; password: string; alias?: string });
- src/index.ts:394-407 (handler)Main handler function for matomo_add_user tool, validates connection and delegates to MatomoApiServiceprivate 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 (helper)Core implementation in MatomoApiService: makes API request to UsersManager.addUser endpointasync 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); }