matomo_get_sites
Retrieve all sites from Matomo Analytics to manage and monitor website tracking configurations through the Matomo MCP Server.
Instructions
Lấy danh sách tất cả các sites trong Matomo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:330-343 (handler)MCP tool handler for matomo_get_sites: validates connection, calls service.getSites(), formats and returns JSON response.private async handleGetSites() { 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 sites = await this.matomoService.getSites(); return { content: [ { type: 'text', text: `Danh sách sites:\n${JSON.stringify(sites, null, 2)}`, }, ], };
- src/services/matomo-api.ts:36-39 (handler)Core handler logic: makes API request to Matomo's SitesManager.getSitesFromGroup and returns sites array.async getSites(): Promise<MatomoSite[]> { const response = await this.makeRequest('SitesManager.getSitesFromGroup'); return Array.isArray(response) ? response : []; }
- src/index.ts:57-64 (schema)Tool schema definition: empty input schema as it requires no parameters.{ name: 'matomo_get_sites', description: 'Lấy danh sách tất cả các sites trong Matomo', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:256-257 (registration)Tool registration in the CallToolRequest switch dispatcher.case 'matomo_get_sites': return await this.handleGetSites();
- src/types/matomo.ts:7-28 (schema)TypeScript interface defining the structure of MatomoSite objects returned by the tool.export interface MatomoSite { idsite: number; name: string; main_url: string; ts_created: string; ecommerce: number; sitesearch: number; sitesearch_keyword_parameters: string; sitesearch_category_parameters: string; timezone: string; currency: string; exclude_unknown_urls: number; excluded_ips: string; excluded_parameters: string; excluded_user_agents: string; group: string; type: string; keep_url_fragment: number; creator_login: string; timezone_name: string; currency_name: string; }