matomo_get_visits_summary
Retrieve total visits, actions, and engagement metrics for a specific Matomo site during a defined period to analyze traffic patterns and performance.
Instructions
Lấy tổng quan lượt truy cập của site
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siteId | Yes | ID của site | |
| date | Yes | Ngày cần lấy dữ liệu (YYYY-MM-DD) | |
| period | No | Chu kỳ (day, week, month, year) | day |
Implementation Reference
- src/services/matomo-api.ts:170-176 (handler)Core handler function that executes the tool logic by calling the Matomo API 'VisitsSummary.get' endpoint with the provided siteId, date, and period parameters.async getVisitsSummary(siteId: number, date: string, period: string = 'day'): Promise<any> { return await this.makeRequest('VisitsSummary.get', { idSite: siteId, date, period, }); }
- src/index.ts:456-470 (handler)MCP server wrapper handler that checks connection, calls the service method, and formats the response as MCP content.private async handleGetVisitsSummary(args: { siteId: number; date: string; period?: 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 summary = await this.matomoService.getVisitsSummary(args.siteId, args.date, args.period); return { content: [ { type: 'text', text: `Tổng quan lượt truy cập:\n${JSON.stringify(summary, null, 2)}`, }, ], }; }
- src/index.ts:185-207 (schema)Input schema and tool metadata definition used for tool registration and validation.{ name: 'matomo_get_visits_summary', description: 'Lấy tổng quan lượt truy cập của site', inputSchema: { type: 'object', properties: { siteId: { type: 'number', description: 'ID của site', }, date: { type: 'string', description: 'Ngày cần lấy dữ liệu (YYYY-MM-DD)', }, period: { type: 'string', description: 'Chu kỳ (day, week, month, year)', default: 'day', }, }, required: ['siteId', 'date'], }, },
- src/index.ts:284-285 (registration)Tool dispatch registration in the CallToolRequestSchema switch statement.case 'matomo_get_visits_summary': return await this.handleGetVisitsSummary(args as { siteId: number; date: string; period?: string });