matomo_get_top_pages
Retrieve the most accessed pages from a Matomo Analytics site by specifying the site ID, date, period, and result limit. Use this tool to analyze web traffic and optimize content performance.
Instructions
Lấy danh sách trang được truy cập nhiều nhất
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Ngày cần lấy dữ liệu (YYYY-MM-DD) | |
| limit | No | Số lượng kết quả tối đa | |
| period | No | Chu kỳ (day, week, month, year) | day |
| siteId | Yes | ID của site |
Implementation Reference
- src/services/matomo-api.ts:206-213 (handler)Core implementation of matomo_get_top_pages: calls Matomo API Actions.getPageUrls with siteId, date, period, and limit 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:211-234 (schema)Input schema for matomo_get_top_pages tool defining required siteId and date, optional period and limit.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)Tool dispatch registration in the CallToolRequestSchema switch statement.case 'matomo_get_top_pages': return await this.handleGetTopPages(args as { siteId: number; date: string; period?: string; limit?: number });
- src/index.ts:472-486 (handler)MCP server wrapper handler for matomo_get_top_pages that validates connection and delegates to MatomoApiService.getTopPages, formats response.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:208-235 (registration)Full tool definition registration in ListToolsRequestSchema response including name, description, and 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'], }, },