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
| 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-1498 (handler)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'], }, },
- src/index.ts:361-373 (schema)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);