Skip to main content
Glama
Augmented-Nature

Ensembl MCP Server

map_coordinates

Convert genomic coordinates between different genome assemblies to align data across versions or species.

Instructions

Convert coordinates between genome assemblies

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionYesGenomic region (chr:start-end)
speciesNoSpecies name (default: homo_sapiens)
target_assemblyYesTarget assembly name

Implementation Reference

  • The handler function for the 'map_coordinates' tool. It fetches coordinate mappings from the Ensembl REST API /map/coords endpoint, converting genomic regions between different assembly versions. Uses helper methods getDefaultSpecies and formatGenomicRegion.
    private async handleMapCoordinates(args: any) {
      try {
        const species = this.getDefaultSpecies(args.species);
        const region = this.formatGenomicRegion(args.region);
    
        const response = await this.apiClient.get(`/map/coords/${species}/${args.target_assembly}/${region}`);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.handleError(error, 'mapping coordinates');
      }
  • src/index.ts:753-764 (registration)
    Tool registration in the ListToolsRequestSchema handler. Defines the name, description, and input schema for the map_coordinates tool.
      name: 'map_coordinates',
      description: 'Convert coordinates between genome assemblies',
      inputSchema: {
        type: 'object',
        properties: {
          region: { type: 'string', description: 'Genomic region (chr:start-end)' },
          species: { type: 'string', description: 'Species name (default: homo_sapiens)' },
          target_assembly: { type: 'string', description: 'Target assembly name' },
        },
        required: ['region', 'target_assembly'],
      },
    },
  • Type guard function for validating input arguments to the map_coordinates tool, though not called in the handler.
    const isValidMapCoordinatesArgs = (
      args: any
    ): args is { region: string; species?: string; target_assembly: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.region === 'string' &&
        args.region.length > 0 &&
        (args.species === undefined || typeof args.species === 'string') &&
        typeof args.target_assembly === 'string' &&
        args.target_assembly.length > 0
      );
    };
  • src/index.ts:866-867 (registration)
    Dispatch case in the CallToolRequestSchema switch statement that routes calls to the map_coordinates handler.
    case 'map_coordinates':
      return this.handleMapCoordinates(args);

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