get_brain_expression
Retrieve protein expression data across brain regions using a specified gene symbol. Output available in JSON or TSV format for analysis and research purposes.
Instructions
Get brain region expression 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:982-1007 (handler)Main handler function for executing the get_brain_expression tool. Validates input using isValidGeneArgs, calls fetchBrainExpression helper, formats result as JSON text content, handles errors.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:768-771 (helper)Core helper that queries the Protein Atlas API for brain-specific expression data by selecting relevant columns like brain_RNA_* and calling the general searchProteins method.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:522-533 (registration)Tool registration in the ListToolsRequestHandler response, defining the tool name, description, and input schema requiring a gene symbol.{ 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:682-683 (handler)Dispatch case in the main CallToolRequestHandler switch statement that routes get_brain_expression calls to the handler function.case 'get_brain_expression': return this.handleGetBrainExpression(args);
- src/index.ts:63-73 (helper)Input validation type guard used by the handler to ensure args has a valid 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)) ); };