Skip to main content
Glama
thichcode

Matomo MCP Server

by thichcode

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
NameRequiredDescriptionDefault
siteIdYesID của site
dateYesNgày cần lấy dữ liệu (YYYY-MM-DD)
periodNoChu kỳ (day, week, month, year)day

Implementation Reference

  • 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,
      });
    }
  • 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)}`,
          },
        ],
      };
    }
  • 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 });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a read-only operation ('Lấy' - get), but doesn't specify any behavioral traits such as authentication requirements, rate limits, error handling, or what the summary includes. This is inadequate for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, though it could be slightly more informative to improve clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the visit summary includes, how data is returned, or any behavioral context, making it insufficient for an agent to fully understand the tool's operation and output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with all parameters well-documented in the input schema. The description adds no additional meaning about the parameters beyond what the schema already provides, so it meets the baseline score of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Lấy tổng quan lượt truy cập của site' clearly states the action ('Lấy' - get) and resource ('tổng quan lượt truy cập của site' - site visit summary), making the purpose understandable. However, it doesn't explicitly differentiate from siblings like 'matomo_get_top_pages' or 'matomo_get_sites', which are also data retrieval tools, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any context, prerequisites, or exclusions, leaving the agent to infer usage from the tool name alone among multiple sibling retrieval tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/thichcode/matomo_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server