get_morphology
Retrieve morphological and physiological data for marine species from FishBase to analyze physical characteristics and biological traits.
Instructions
Get morphological and physiological data for a species
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| species_name | Yes | Scientific name of the species |
Implementation Reference
- src/index.ts:96-109 (registration)Registration of the 'get_morphology' MCP tool in the server's listTools response, including its input schema definition.{ name: "get_morphology", description: "Get morphological and physiological data for a species", inputSchema: { type: "object", properties: { species_name: { type: "string", description: "Scientific name of the species", }, }, required: ["species_name"], }, },
- src/index.ts:215-227 (handler)Handler for the 'get_morphology' tool in the MCP server's CallToolRequestSchema, which calls FishBaseAPI.getMorphology and returns the result as formatted JSON text content.case "get_morphology": return { content: [ { type: "text", text: JSON.stringify( await fishbaseAPI.getMorphology(args.species_name as string), null, 2 ), }, ], };
- src/fishbase-api.ts:100-114 (helper)Core implementation of getMorphology method in FishBaseAPI class. Retrieves the species SpecCode and filters the 'morphdat' table data for morphological information.async getMorphology(speciesName: string): Promise<any[]> { try { const speciesData = await this.getSpecies(speciesName); if (speciesData.length === 0) { throw new Error(`Species not found: ${speciesName}`); } const specCode = speciesData[0].SpecCode; const morphData = await this.queryTable('morphdat'); return morphData.filter((row: any) => row.SpecCode === specCode); } catch (error) { throw new Error(`Failed to get morphology data: ${error}`); } }