Skip to main content
Glama

get_analytics_data

Retrieve visitor statistics and popularity trends for biological ontologies with optional date and ontology filtering.

Instructions

Get visitor statistics and popularity trends with optional date filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
monthNoMonth (1-12) for specific data
yearNoYear for specific data (2013+)
ontologyNoSpecific ontology acronym (optional)

Implementation Reference

  • The core handler function that validates input, constructs API parameters and endpoint (/analytics or /ontologies/{ontology}/analytics), fetches data from BioOntology API, and returns formatted JSON response or error.
    private async handleGetAnalyticsData(args: any) {
      if (!isValidGetAnalyticsArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid analytics data arguments');
      }
    
      try {
        const params: any = {
          apikey: this.apiKey,
        };
    
        if (args.month !== undefined) params.month = args.month;
        if (args.year !== undefined) params.year = args.year;
    
        let endpoint = '/analytics';
        if (args.ontology) {
          endpoint = `/ontologies/${args.ontology}/analytics`;
        }
    
        const response = await this.apiClient.get(endpoint, { params });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching analytics data: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema defining optional parameters: month (1-12), year (>=2013), ontology (string). Used for MCP tool specification and validation.
    inputSchema: {
      type: 'object',
      properties: {
        month: { type: 'number', description: 'Month (1-12) for specific data', minimum: 1, maximum: 12 },
        year: { type: 'number', description: 'Year for specific data (2013+)', minimum: 2013 },
        ontology: { type: 'string', description: 'Specific ontology acronym (optional)' },
      },
      required: [],
    },
  • src/index.ts:680-692 (registration)
    Tool registration in the MCP server's tools list, including name, description, and input schema.
    {
      name: 'get_analytics_data',
      description: 'Get visitor statistics and popularity trends with optional date filtering',
      inputSchema: {
        type: 'object',
        properties: {
          month: { type: 'number', description: 'Month (1-12) for specific data', minimum: 1, maximum: 12 },
          year: { type: 'number', description: 'Year for specific data (2013+)', minimum: 2013 },
          ontology: { type: 'string', description: 'Specific ontology acronym (optional)' },
        },
        required: [],
      },
    },
  • Type guard function for validating input arguments against the expected schema before executing the handler.
    const isValidGetAnalyticsArgs = (
      args: any
    ): args is { month?: number; year?: number; ontology?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        (args.month === undefined || (typeof args.month === 'number' && args.month >= 1 && args.month <= 12)) &&
        (args.year === undefined || (typeof args.year === 'number' && args.year >= 2013)) &&
        (args.ontology === undefined || typeof args.ontology === 'string')
      );
    };
  • src/index.ts:722-723 (registration)
    Switch case in the main CallToolRequestHandler that routes calls to the specific handler method.
    case 'get_analytics_data':
      return this.handleGetAnalyticsData(args);
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does, not behavioral traits. It doesn't disclose if this is a read-only operation, rate limits, authentication needs, or what format the statistics/trends are returned in. For a tool with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, stating the core purpose first ('Get visitor statistics and popularity trends') followed by a key feature ('with optional date filtering'). Every word earns its place.

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 no annotations, no output schema, and 3 parameters, the description is incomplete. It doesn't explain what 'visitor statistics and popularity trends' includes, how data is returned, or behavioral aspects like safety or performance. For a data retrieval tool with zero structured context, the description should provide more operational details.

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?

Schema description coverage is 100%, so the schema fully documents all 3 parameters. The description adds marginal value by mentioning 'optional date filtering' which aligns with month/year parameters, but doesn't provide additional semantics beyond what's in the schema. Baseline 3 is appropriate when schema does the heavy lifting.

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 clearly states the tool's purpose: 'Get visitor statistics and popularity trends' specifies the verb (get) and resource (analytics data). It distinguishes from siblings like 'get_ontology_metrics' by focusing on visitor data rather than ontology metrics. However, it doesn't explicitly differentiate from all siblings, keeping it at 4 rather than 5.

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 minimal guidance with 'with optional date filtering' hinting at when to use parameters, but offers no explicit when-to-use context, no alternatives among siblings, and no prerequisites. It lacks comparison to tools like 'get_ontology_metrics' for analytics, leaving the agent with little direction on selection.

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/Augmented-Nature/BioOntology-MCP-Server'

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