get_pathology_data
Retrieve cancer and pathology data for specific proteins using gene symbols. Supports JSON and TSV formats to access detailed protein-related information from the Human Protein Atlas.
Instructions
Get cancer and pathology data for a protein
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Output format (default: json) | |
| gene | Yes | Gene symbol |
Implementation Reference
- src/index.ts:1071-1098 (handler)Main handler function for the 'get_pathology_data' tool. Validates input using isValidGeneArgs, fetches pathology data via fetchPathologyData(gene), and returns JSON-formatted result or error.private async handleGetPathologyData(args: any) { if (!isValidGeneArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid gene arguments'); } try { const result = await this.fetchPathologyData(args.gene); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching pathology data: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:758-761 (helper)Core helper method that performs the actual API query for pathology data using searchProteins with specific prognostic columns for various cancers.private async fetchPathologyData(gene: string): Promise<any> { const columns = ['g', 'eg', 'prognostic_Breast_Invasive_Carcinoma_(TCGA)', 'prognostic_Colon_Adenocarcinoma_(TCGA)', 'prognostic_Lung_Adenocarcinoma_(TCGA)', 'prognostic_Prostate_Adenocarcinoma_(TCGA)']; return this.searchProteins(gene, 'json', columns, 1); }
- src/index.ts:562-573 (registration)Tool registration in the ListTools response, defining name, description, and input schema requiring 'gene' parameter.{ name: 'get_pathology_data', description: 'Get cancer and pathology data for a protein', inputSchema: { type: 'object', properties: { gene: { type: 'string', description: 'Gene symbol' }, format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' }, }, required: ['gene'], }, },
- src/index.ts:690-691 (registration)Dispatch case in CallToolRequestSchema handler that routes 'get_pathology_data' calls to the handleGetPathologyData method.case 'get_pathology_data': return this.handleGetPathologyData(args);
- src/index.ts:63-73 (schema)Type guard function used to validate input arguments for gene-based tools like get_pathology_data, checking for required 'gene' string and optional format.const isValidGeneArgs = ( args: any ): args is { gene: string; format?: string } => { return ( typeof args === 'object' && args !== null && typeof args.gene === 'string' && args.gene.length > 0 && (args.format === undefined || ['json', 'tsv', 'xml', 'trig'].includes(args.format)) ); };