matomo_connect
Establish a secure connection to a Matomo instance by providing the base URL and authentication token, enabling interaction with the Matomo Analytics API for managing sites, users, goals, segments, and accessing analytics reports.
Instructions
Kết nối đến Matomo instance với URL và token xác thực
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| baseUrl | Yes | URL của Matomo instance (ví dụ: https://analytics.example.com) | |
| tokenAuth | Yes | Token xác thực Matomo API |
Implementation Reference
- src/index.ts:309-328 (handler)The primary handler function that implements the 'matomo_connect' tool logic. It constructs a MatomoConfig from input arguments, instantiates the MatomoApiService, tests the connection via getSites(), and responds with a success message.private async handleConnect(args: { baseUrl: string; tokenAuth: string }) { const config: MatomoConfig = { baseUrl: args.baseUrl, tokenAuth: args.tokenAuth, }; this.matomoService = new MatomoApiService(config); // Test connection await this.matomoService.getSites(); return { content: [ { type: 'text', text: `Đã kết nối thành công đến Matomo tại ${args.baseUrl}`, }, ], }; }
- src/index.ts:39-56 (schema)The schema definition for the 'matomo_connect' tool, including input parameters baseUrl and tokenAuth as required fields.{ name: 'matomo_connect', description: 'Kết nối đến Matomo instance với URL và token xác thực', inputSchema: { type: 'object', properties: { baseUrl: { type: 'string', description: 'URL của Matomo instance (ví dụ: https://analytics.example.com)', }, tokenAuth: { type: 'string', description: 'Token xác thực Matomo API', }, }, required: ['baseUrl', 'tokenAuth'], }, },
- src/index.ts:253-255 (registration)The dispatch case in the CallToolRequestHandler that registers and routes calls to the matomo_connect handler.case 'matomo_connect': return await this.handleConnect(args as { baseUrl: string; tokenAuth: string });