common_to_scientific
Convert fish common names to scientific names using FishBase marine biology data for accurate species identification and research.
Instructions
Convert common name to scientific name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| common_name | Yes | Common name of the fish |
Implementation Reference
- src/index.ts:243-255 (handler)Handler for the 'common_to_scientific' tool in the MCP CallToolRequestSchema. It invokes the FishBaseAPI method and returns the result as JSON text content.case "common_to_scientific": return { content: [ { type: "text", text: JSON.stringify( await fishbaseAPI.commonToScientific(args.common_name as string), null, 2 ), }, ], };
- src/index.ts:127-136 (schema)Input schema definition for the 'common_to_scientific' tool, specifying that 'common_name' (string) is required.inputSchema: { type: "object", properties: { common_name: { type: "string", description: "Common name of the fish", }, }, required: ["common_name"], },
- src/index.ts:124-137 (registration)Registration of the 'common_to_scientific' tool in the MCP server's ListTools response, including name, description, and input schema.{ name: "common_to_scientific", description: "Convert common name to scientific name", inputSchema: { type: "object", properties: { common_name: { type: "string", description: "Common name of the fish", }, }, required: ["common_name"], }, },
- src/fishbase-api.ts:137-149 (helper)Helper method in FishBaseAPI that implements the core logic: queries the 'species' table and filters rows where FBname contains the given common name, returning up to 10 matches.async commonToScientific(commonName: string): Promise<SpeciesData[]> { try { const speciesData = await this.queryTable('species'); const filtered = speciesData.filter((row: any) => row.FBname?.toLowerCase().includes(commonName.toLowerCase()) ); return filtered.slice(0, 10); } catch (error) { throw new Error(`Failed to convert common name: ${error}`); } }