validate_species_name
Validate and correct scientific species names using the MCP FishBase Server, ensuring accuracy for marine biology research and data analysis.
Instructions
Validate and correct species scientific names
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| species_name | Yes | Scientific name to validate |
Implementation Reference
- src/fishbase-api.ts:116-135 (handler)Core handler function that validates a species name by checking for exact match or providing suggestions using getSpecies and searchSpecies methods.async validateSpeciesName(speciesName: string): Promise<{ valid: boolean; suggestions?: string[]; match?: SpeciesData }> { try { const exactMatch = await this.getSpecies(speciesName); if (exactMatch.length > 0) { return { valid: true, match: exactMatch[0] }; } const searchResults = await this.searchSpecies(speciesName, 5); return { valid: false, suggestions: searchResults.map(s => `${s.Genus} ${s.Species}`), }; } catch (error) { throw new Error(`Failed to validate species name: ${error}`); } }
- src/index.ts:111-123 (schema)Tool schema definition including name, description, and input schema registered in listTools handler.name: "validate_species_name", description: "Validate and correct species scientific names", inputSchema: { type: "object", properties: { species_name: { type: "string", description: "Scientific name to validate", }, }, required: ["species_name"], }, },
- src/index.ts:229-241 (registration)Registration and dispatch logic in the CallToolRequestSchema handler that routes calls to the validateSpeciesName method.case "validate_species_name": return { content: [ { type: "text", text: JSON.stringify( await fishbaseAPI.validateSpeciesName(args.species_name as string), null, 2 ), }, ], };