Skip to main content
Glama
kshayk

AviBase MCP Server

by kshayk

execute_jsonata_query

Transform and analyze JSON data using JSONata queries, enabling advanced extraction and manipulation of bird-related information from the AviBase dataset.

Instructions

Execute a raw JSONata query for advanced data analysis and transformation. JSONata is a powerful query language for JSON data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results to return for array results (default: 50)
queryYesJSONata query expression (e.g., "$count($[Taxon_rank = \"species\"])" to count species)

Implementation Reference

  • The handler function that destructures args for query and limit, sends a POST request to the /query API endpoint with the JSONata query, processes the response to format results as markdown text (handling array or single object), and returns structured MCP content.
    async handleExecuteJsonataQuery(args) { const { query, limit = 50 } = args; const endpoint = `/query`; const response = await this.makeAPIRequest(endpoint, { method: 'POST', body: JSON.stringify({ query, limit }), }); let resultText; if (Array.isArray(response.data)) { resultText = `**Query:** \`${query}\` **Result Type:** Array with ${response.pagination?.totalItems || response.data.length} items **Results:** ${response.data.map((item, i) => `${i + 1}. ${typeof item === 'object' ? JSON.stringify(item, null, 2) : item}`).join('\n\n')}`; } else { resultText = `**Query:** \`${query}\` **Result Type:** ${typeof response.data} **Result:** ${typeof response.data === 'object' ? JSON.stringify(response.data, null, 2) : response.data}`; } return { content: [ { type: 'text', text: `# JSONata Query Execution ${resultText} ${response.pagination?.hasNext ? `\n*Note: Showing first ${response.data.length} of ${response.pagination.totalItems} total results.*` : ''}`, }, ], }; }
  • Input schema definition for the tool, including properties for 'query' (required string) and 'limit' (optional number with default), along with tool name and description.
    name: 'execute_jsonata_query', description: 'Execute a raw JSONata query for advanced data analysis and transformation. JSONata is a powerful query language for JSON data.', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'JSONata query expression (e.g., "$count($[Taxon_rank = \\"species\\"])" to count species)', }, limit: { type: 'number', description: 'Maximum number of results to return for array results (default: 50)', default: 50, }, }, required: ['query'], }, }, ],
  • mcp-server.js:318-319 (registration)
    Dispatch registration in the switch statement handling CallTool requests, mapping the tool name to its handler function.
    case 'execute_jsonata_query': return await this.handleExecuteJsonataQuery(args);

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/kshayk/avibase-mcp'

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