Skip to main content
Glama

get_protein_by_ensembl

Retrieve protein expression, localization, and pathology data from the Human Protein Atlas using Ensembl gene identifiers.

Instructions

Get protein information using Ensembl gene ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ensemblIdYesEnsembl gene ID (e.g., ENSG00000139618)
formatNoOutput format (default: json)

Implementation Reference

  • Primary handler for the 'get_protein_by_ensembl' tool. Validates input arguments, calls the fetch helper, formats the result as MCP content, and handles errors appropriately.
    private async handleGetProteinByEnsembl(args: any) { if (!isValidEnsemblArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid Ensembl arguments'); } try { const result = await this.fetchProteinDataByEnsembl(args.ensemblId, args.format || 'json'); return { content: [ { type: 'text', text: typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching protein by Ensembl ID: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; }
  • Core helper function that makes the HTTP GET request to the Human Protein Atlas API endpoint for the given Ensembl ID and format, then parses the response.
    private async fetchProteinDataByEnsembl(ensemblId: string, format: string = 'json'): Promise<any> { const response = await this.apiClient.get(`/${ensemblId}.${format}`); return this.parseResponse(response.data, format); }
  • Input schema for the tool defining the expected parameters: required 'ensemblId' string and optional 'format' enum.
    inputSchema: { type: 'object', properties: { ensemblId: { type: 'string', description: 'Ensembl gene ID (e.g., ENSG00000139618)' }, format: { type: 'string', enum: ['json', 'tsv', 'xml', 'trig'], description: 'Output format (default: json)' }, }, required: ['ensemblId'], },
  • src/index.ts:673-674 (registration)
    Registration in the tool dispatch switch statement within the CallToolRequest handler, routing calls to the specific handler method.
    case 'get_protein_by_ensembl': return this.handleGetProteinByEnsembl(args);
  • Type guard validation function matching the input schema, used by the handler to validate arguments before processing.
    const isValidEnsemblArgs = ( args: any ): args is { ensemblId: string; format?: string } => { return ( typeof args === 'object' && args !== null && typeof args.ensemblId === 'string' && args.ensemblId.length > 0 && (args.format === undefined || ['json', 'tsv', 'xml', 'trig'].includes(args.format)) ); };

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/ProteinAtlas-MCP-Server'

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