map_coordinates
Convert genomic coordinates between different assemblies for accurate data mapping, supporting species-specific genome analysis in the Ensembl MCP Server.
Instructions
Convert coordinates between genome assemblies
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | Yes | Genomic region (chr:start-end) | |
| species | No | Species name (default: homo_sapiens) | |
| target_assembly | Yes | Target assembly name |
Implementation Reference
- src/index.ts:1481-1499 (handler)The handler function that executes the map_coordinates tool. It validates input implicitly through execution, formats the region and species, calls the Ensembl REST API endpoint `/map/coords/{species}/{target_assembly}/{region}` to convert genomic coordinates between assemblies, and returns the result as JSON.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 (schema)The input schema definition for the map_coordinates tool, registered in the ListTools response, defining parameters: region (required), species (optional), target_assembly (required).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'], }, },
- src/index.ts:867-867 (registration)The switch case in the CallToolRequestSchema handler that registers and dispatches to the map_coordinates tool handler.return this.handleMapCoordinates(args);
- src/index.ts:361-373 (schema)Type guard function for validating input arguments to the map_coordinates tool.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 ); };