get_brain_expression
Retrieve brain region expression data for proteins to analyze tissue-specific protein distribution using Human Protein Atlas information.
Instructions
Get brain region expression data for a protein
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gene | Yes | Gene symbol | |
| format | No | Output format (default: json) |
Implementation Reference
- src/index.ts:982-1008 (handler)The main handler function for the 'get_brain_expression' tool. Validates input using isValidGeneArgs, fetches brain expression data via fetchBrainExpression, and returns formatted JSON response or error.private async handleGetBrainExpression(args: any) { if (!isValidGeneArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid gene arguments'); } try { const result = await this.fetchBrainExpression(args.gene); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching brain expression: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:522-533 (registration)Tool registration in the listTools response, including name, description, and input schema definition.{ name: 'get_brain_expression', description: 'Get brain region expression 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:525-532 (schema)Input schema defining parameters for the get_brain_expression tool: required 'gene' string and optional 'format'.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:768-771 (helper)Helper method that performs the API query to Human Protein Atlas with specific columns for brain tissue expression data.private async fetchBrainExpression(gene: string): Promise<any> { const columns = ['g', 'eg', 'rnabrs', 'rnabrd', 'rnabrss', 'brain_RNA_amygdala', 'brain_RNA_cerebellum', 'brain_RNA_cerebral_cortex', 'brain_RNA_hippocampal_formation', 'brain_RNA_hypothalamus']; return this.searchProteins(gene, 'json', columns, 1); }
- src/index.ts:63-73 (helper)Input validation helper function used by get_brain_expression and similar tools to validate gene and optional format arguments.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)) ); };