Skip to main content
Glama
lundgrenalex

MCP FishBase Server

by lundgrenalex

get_distribution

Retrieve geographic distribution and occurrence data for marine species using scientific names. Access FishBase marine biology records to identify where species are found globally.

Instructions

Get distribution/occurrence information for a species

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
species_nameYesScientific name of the species

Implementation Reference

  • src/index.ts:82-95 (registration)
    Registration of the 'get_distribution' tool in the MCP server's ListToolsRequestHandler, including name, description, and input schema.
    {
      name: "get_distribution",
      description: "Get distribution/occurrence information for a species",
      inputSchema: {
        type: "object",
        properties: {
          species_name: {
            type: "string",
            description: "Scientific name of the species",
          },
        },
        required: ["species_name"],
      },
    },
  • MCP CallToolRequestHandler case for 'get_distribution' that calls the FishBaseAPI.getDistribution method and returns JSON response.
    case "get_distribution":
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              await fishbaseAPI.getDistribution(args.species_name as string),
              null,
              2
            ),
          },
        ],
      };
  • Core implementation of getDistribution in FishBaseAPI: retrieves species SpecCode, queries occurrence table, filters by SpecCode, handles errors.
    async getDistribution(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 distData = await this.queryTable('occurrence');
        
        return distData.filter((row: any) => row.SpecCode === specCode);
      } catch (error) {
        throw new Error(`Failed to get distribution data: ${error}`);
      }
    }
  • Input schema definition for the 'get_distribution' tool, specifying required 'species_name' parameter.
    inputSchema: {
      type: "object",
      properties: {
        species_name: {
          type: "string",
          description: "Scientific name of the species",
        },
      },
      required: ["species_name"],
    },

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/lundgrenalex/mcp-fishbase'

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