Skip to main content
Glama
kshayk

AviBase MCP Server

by kshayk

execute_jsonata_query

Execute JSONata queries to analyze and transform bird data from the AviBase dataset for advanced data processing.

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
queryYesJSONata query expression (e.g., "$count($[Taxon_rank = \"species\"])" to count species)
limitNoMaximum number of results to return for array results (default: 50)

Implementation Reference

  • The handler function that destructures query and optional limit from args, sends POST to /query endpoint with JSON body, processes response into formatted markdown text distinguishing array or single result, and returns structured 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 defining required 'query' string and optional 'limit' number for the tool.
    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)
    Switch case dispatching tool calls to the specific handler method.
    case 'execute_jsonata_query':
      return await this.handleExecuteJsonataQuery(args);
  • mcp-server.js:259-277 (registration)
    Tool definition object added to the tools list for ListToolsRequestHandler, including name, description, and inputSchema.
    {
      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'],
      },
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool executes queries but doesn't mention what data source it queries, what permissions are required, whether there are rate limits, what happens with malformed queries, or what the output format looks like. The description is too vague about the actual behavior.

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 appropriately concise with two sentences that each add value. The first sentence states the core purpose, and the second provides context about JSONata's capabilities. There's no wasted text, though it could be more front-loaded with critical usage information.

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?

For a tool with no annotations, no output schema, and 2 parameters (one optional), the description is insufficient. It doesn't explain what data is being queried (bird data based on siblings?), what the return format is, error handling, or how this differs from the many specialized bird query tools. The context signals suggest this is part of a bird-related API, but the description doesn't acknowledge this domain context.

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 already fully documents both parameters. The description adds no additional parameter information beyond what's in the schema. It mentions JSONata generally but doesn't provide context about the 'query' parameter format or 'limit' usage beyond the schema's default value.

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 as 'Execute a raw JSONata query for advanced data analysis and transformation' with a specific verb ('execute') and resource ('JSONata query'). It distinguishes from sibling tools by mentioning JSONata specifically, but doesn't explicitly contrast with the various bird-related sibling tools that appear to be domain-specific queries.

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 the many sibling tools (like custom_bird_query, get_bird_report, etc.). It mentions JSONata is for 'advanced data analysis and transformation' but gives no context about when raw JSONata is preferred over the specialized bird query 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/kshayk/avibase-mcp'

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