Skip to main content
Glama
Augmented-Nature

Ensembl MCP Server

get_assembly_info

Retrieve genome assembly details and statistics for species, including chromosome banding patterns when specified.

Instructions

Get genome assembly information and statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
speciesNoSpecies name (default: homo_sapiens)
bandsNoInclude chromosome banding patterns (default: false)

Implementation Reference

  • src/index.ts:778-788 (registration)
    Registration of the get_assembly_info tool in the ListToolsRequestSchema response, defining its name, description, and input schema.
      name: 'get_assembly_info',
      description: 'Get genome assembly information and statistics',
      inputSchema: {
        type: 'object',
        properties: {
          species: { type: 'string', description: 'Species name (default: homo_sapiens)' },
          bands: { type: 'boolean', description: 'Include chromosome banding patterns (default: false)' },
        },
        required: [],
      },
    },
  • src/index.ts:871-872 (registration)
    Maps the tool name to its handler function in the CallToolRequestSchema switch statement.
    case 'get_assembly_info':
      return this.handleGetAssemblyInfo(args);
  • The handler function that executes the tool: validates args, fetches data from Ensembl REST API endpoint `/info/assembly/{species}`, formats response as JSON, handles errors.
    private async handleGetAssemblyInfo(args: any) {
      if (!isValidAssemblyArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid assembly info arguments');
      }
    
      try {
        const species = this.getDefaultSpecies(args.species);
    
        const params: any = {};
    
        if (args.bands) {
          params.bands = 1;
        }
    
        const response = await this.apiClient.get(`/info/assembly/${species}`, { params });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.handleError(error, 'fetching assembly info');
      }
    }
  • Input validation type guard used in the handler to ensure arguments conform to expected schema.
    const isValidAssemblyArgs = (
      args: any
    ): args is { species?: string; bands?: boolean } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        (args.species === undefined || typeof args.species === 'string') &&
        (args.bands === undefined || typeof args.bands === 'boolean')
      );
    };
  • TypeScript interface matching the expected response structure from the Ensembl assembly info API.
    interface EnsemblAssemblyInfo {
      assembly_name: string;
      assembly_date: string;
      assembly_accession: string;
      genebuild_last_geneset_update: string;
      genebuild_initial_release_date: string;
      genebuild_start_date: string;
      genebuild_version: string;
      genebuild_method: string;
      golden_path_length: number;
      total_coding_sequence_length: number;
      total_genome_length: number;
      coord_system_versions: string[];
      karyotype: string[];
    }

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/Augmented-Nature/Ensembl-MCP-Server'

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