matomo_add_site
Add a new site to Matomo Analytics for tracking and monitoring website performance data through the Matomo MCP Server.
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 | |
| urls | Yes | Danh sách URLs của site | |
| timezone | No | Múi giờ của site (mặc định: UTC) | UTC |
Implementation Reference
- src/services/matomo-api.ts:46-53 (handler)Core implementation of the matomo_add_site tool: calls Matomo SitesManager.addSite API via makeRequest helper.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-375 (handler)MCP server handler wrapper for matomo_add_site: checks connection and delegates to MatomoApiService.addSite.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:82-100 (schema)Input schema definition for the matomo_add_site tool, specifying parameters name, urls (required), and optional timezone.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:79-102 (registration)Tool registration in ListToolsResponse: defines name, description, and inputSchema for matomo_add_site.{ 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-263 (registration)Dispatch registration in CallToolRequestSchema switch statement.case 'matomo_add_site': return await this.handleAddSite(args as { name: string; urls: string[]; timezone?: string });