Skip to main content
Glama

get_analytics_data

Access visitor statistics and popularity trends for BioOntology, with optional filtering by month, year, or specific ontology, to analyze usage patterns and insights.

Instructions

Get visitor statistics and popularity trends with optional date filtering

Input Schema

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

Implementation Reference

  • src/index.ts:680-692 (registration)
    Registers the 'get_analytics_data' tool with the MCP server, including its description and detailed input schema for parameters like month, year, and optional ontology.
    { 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: [], }, },
  • The primary handler function for the get_analytics_data tool. Validates input args, builds the API request to the BioOntology analytics endpoint (global or ontology-specific), fetches data, and returns formatted JSON response or error content.
    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 validation schema as a type guard function that checks arguments conform to expected types and ranges for month (1-12), year (>=2013), and optional ontology string.
    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)
    Dispatcher switch case in the CallToolRequestHandler that maps tool name 'get_analytics_data' to its handler method.
    case 'get_analytics_data': return this.handleGetAnalyticsData(args);

Other Tools

Related 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