Skip to main content
Glama

get_karyotype

Retrieve chromosome information and karyotype data for specified species from Ensembl genomic database.

Instructions

Get chromosome information and karyotype

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
speciesNoSpecies name (default: homo_sapiens)

Implementation Reference

  • The handler function that executes the get_karyotype tool. It validates input, queries the Ensembl REST API /info/assembly/{species}?bands=1 endpoint, extracts karyotype and chromosome data, and formats the response.
    private async handleGetKaryotype(args: any) { if (!isValidAssemblyArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid karyotype arguments'); } try { const species = this.getDefaultSpecies(args.species); const response = await this.apiClient.get(`/info/assembly/${species}`, { params: { bands: 1 }, }); return { content: [ { type: 'text', text: JSON.stringify({ species, assembly_name: response.data.assembly_name, karyotype: response.data.karyotype || [], chromosomes: response.data.top_level_region || [], }, null, 2), }, ], }; } catch (error) { return this.handleError(error, 'fetching karyotype'); } }
  • src/index.ts:873-874 (registration)
    The switch case in the CallToolRequestSchema handler that routes calls to the get_karyotype tool to its handler function.
    case 'get_karyotype': return this.handleGetKaryotype(args);
  • src/index.ts:790-799 (registration)
    The tool registration entry in the ListToolsRequestSchema response, defining the name, description, and input schema for get_karyotype.
    name: 'get_karyotype', description: 'Get chromosome information and karyotype', inputSchema: { type: 'object', properties: { species: { type: 'string', description: 'Species name (default: homo_sapiens)' }, }, required: [], }, },
  • Type guard function used to validate input arguments for the get_karyotype tool (shared with get_assembly_info).
    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') ); };
  • Utility method used in get_karyotype handler to provide default species value.
    private getDefaultSpecies(species?: string): string { return species || 'homo_sapiens'; }

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