matomo_get_top_pages
Retrieve the most visited pages from Matomo Analytics for a specific site and date range to identify popular content and user behavior patterns.
Instructions
Lấy danh sách trang được truy cập nhiều nhất
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 |
| limit | No | Số lượng kết quả tối đa |
Implementation Reference
- src/services/matomo-api.ts:206-213 (handler)Core handler implementing the tool logic by calling Matomo API method Actions.getPageUrls to fetch top pages.async getTopPages(siteId: number, date: string, period: string = 'day', limit: number = 10): Promise<any> { return await this.makeRequest('Actions.getPageUrls', { idSite: siteId, date, period, filter_limit: limit, }); }
- src/index.ts:472-486 (handler)MCP server wrapper handler that checks connection and calls the MatomoApiService.getTopPages.private async handleGetTopPages(args: { siteId: number; date: string; period?: string; limit?: number }) { 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 pages = await this.matomoService.getTopPages(args.siteId, args.date, args.period, args.limit); return { content: [ { type: 'text', text: `Top pages:\n${JSON.stringify(pages, null, 2)}`, }, ], }; }
- src/index.ts:211-234 (schema)Input schema defining parameters for the matomo_get_top_pages tool.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', }, limit: { type: 'number', description: 'Số lượng kết quả tối đa', default: 10, }, }, required: ['siteId', 'date'], },
- src/index.ts:208-235 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: 'matomo_get_top_pages', description: 'Lấy danh sách trang được truy cập nhiều nhất', 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', }, limit: { type: 'number', description: 'Số lượng kết quả tối đa', default: 10, }, }, required: ['siteId', 'date'], }, },
- src/index.ts:287-288 (registration)Switch case registration in CallToolRequest handler dispatching to the tool's handler function.case 'matomo_get_top_pages': return await this.handleGetTopPages(args as { siteId: number; date: string; period?: string; limit?: number });