custom_bird_query
Analyze bird data using advanced filters for family, order, IUCN status, and taxon rank with AviBase MCP Server’s query tool, designed for precise, in-depth research.
Instructions
Perform complex queries with multiple filters for advanced bird data analysis.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filters | Yes | Object containing field-value pairs for filtering | |
| limit | No | Maximum number of results to return (default: 50) |
Implementation Reference
- mcp-server.js:619-651 (handler)The primary handler function executing the tool logic: extracts filters and limit from args, POSTs to /custom API endpoint, formats results into a markdown response with bird details.async handleCustomBirdQuery(args) { const { filters, limit = 50 } = args; const endpoint = `/custom`; const response = await this.makeAPIRequest(endpoint, { method: 'POST', body: JSON.stringify({ filters, limit }), }); const filterDescription = Object.entries(filters) .map(([key, value]) => `${key}: ${Array.isArray(value) ? value.join(', ') : value}`) .join(', '); return { content: [ { type: 'text', text: `# Custom Query Results 🎯 **Query Filters:** ${filterDescription} 📊 **Results:** ${response.pagination.totalItems} birds found ${response.data.map((bird, i) => `${i + 1}. **${bird.Scientific_name}** - Common name: ${bird.English_name_AviList || 'No common name'} - Family: ${bird.Family} - Order: ${bird.Order} - Conservation: ${bird.IUCN_Red_List_Category || 'Not assessed'} - Range: ${bird.Range ? bird.Range.substring(0, 80) + '...' : 'No range data'}`).join('\n\n')} ${response.pagination.hasNext ? `\n*Note: Showing first ${response.data.length} of ${response.pagination.totalItems} total matching records.*` : ''}`, }, ], }; }
- mcp-server.js:234-256 (schema)Input schema validating the tool arguments: requires 'filters' object with optional fields like Family, Order, etc., and optional 'limit'.inputSchema: { type: 'object', properties: { filters: { type: 'object', description: 'Object containing field-value pairs for filtering', properties: { Family: { type: 'string' }, Order: { type: 'string' }, IUCN_Red_List_Category: { type: 'array', items: { type: 'string' } }, Taxon_rank: { type: 'string' }, }, }, limit: { type: 'number', description: 'Maximum number of results to return (default: 50)', default: 50, }, }, required: ['filters'],
- mcp-server.js:231-258 (registration)Tool registration object defining name, description, and inputSchema, added to the MCP server's tools list.{ name: 'custom_bird_query', description: 'Perform complex queries with multiple filters for advanced bird data analysis.', inputSchema: { type: 'object', properties: { filters: { type: 'object', description: 'Object containing field-value pairs for filtering', properties: { Family: { type: 'string' }, Order: { type: 'string' }, IUCN_Red_List_Category: { type: 'array', items: { type: 'string' } }, Taxon_rank: { type: 'string' }, }, }, limit: { type: 'number', description: 'Maximum number of results to return (default: 50)', default: 50, }, }, required: ['filters'], }, },
- mcp-server.js:315-316 (registration)Dispatch case in the central tool request handler switch statement, routing calls to the handler function.case 'custom_bird_query': return await this.handleCustomBirdQuery(args);