matomo_add_site
Add a new site to Matomo Analytics with specified name, URLs, and timezone. Integrates via MCP server to streamline site management and configuration.
Instructions
Thêm một site mới vào Matomo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Tên của site | |
| timezone | No | Múi giờ của site (mặc định: UTC) | UTC |
| urls | Yes | Danh sách URLs của site |
Implementation Reference
- src/services/matomo-api.ts:46-53 (handler)Core implementation of adding a site to Matomo using the SitesManager.addSite API endpoint.async addSite(name: string, urls: string[], timezone: string = 'UTC'): Promise<number> { const response = await this.makeRequest('SitesManager.addSite', { siteName: name, urls: urls.join(','), timezone, }); return response.value; }
- src/index.ts:362-376 (handler)MCP server handler for matomo_add_site tool, checks connection and delegates to MatomoApiService.private async handleAddSite(args: { name: string; urls: string[]; timezone?: 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.'); } const siteId = await this.matomoService.addSite(args.name, args.urls, args.timezone); return { content: [ { type: 'text', text: `Đã thêm site thành công với ID: ${siteId}`, }, ], }; }
- src/index.ts:79-102 (schema)Input schema definition for the matomo_add_site tool, specifying parameters name, urls, and optional timezone.{ name: 'matomo_add_site', description: 'Thêm một site mới vào Matomo', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Tên của site', }, urls: { type: 'array', items: { type: 'string' }, description: 'Danh sách URLs của site', }, timezone: { type: 'string', description: 'Múi giờ của site (mặc định: UTC)', default: 'UTC', }, }, required: ['name', 'urls'], }, },
- src/index.ts:262-264 (registration)Switch case registration mapping tool name to its handler in CallToolRequestSchema.case 'matomo_add_site': return await this.handleAddSite(args as { name: string; urls: string[]; timezone?: string });