get_blood_expression
Retrieve blood cell expression data for a specific protein by entering a gene symbol. Output formats include JSON or TSV, with JSON as the default.
Instructions
Get blood cell 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:954-979 (handler)The main handler function for the get_blood_expression tool. Validates input arguments, fetches blood expression data using the helper method, and returns formatted JSON response or error.private async handleGetBloodExpression(args: any) { if (!isValidGeneArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid gene arguments'); } try { const result = await this.fetchBloodExpression(args.gene); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching blood expression: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; }
- src/index.ts:510-521 (registration)Tool registration in the ListToolsRequestSchema handler, defining the tool name, description, and input schema.{ name: 'get_blood_expression', description: 'Get blood cell 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:763-766 (helper)Helper method that performs the actual API query for blood expression data using specific column names from the Human Protein Atlas.private async fetchBloodExpression(gene: string): Promise<any> { const columns = ['g', 'eg', 'rnabcs', 'rnabcd', 'rnabcss', 'blood_RNA_basophil', 'blood_RNA_classical_monocyte', 'blood_RNA_eosinophil', 'blood_RNA_neutrophil', 'blood_RNA_NK-cell']; return this.searchProteins(gene, 'json', columns, 1); }
- src/index.ts:63-72 (helper)Shared input validation type guard used by the handler to validate gene symbol 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)) );
- src/index.ts:680-681 (registration)Dispatch case in the CallToolRequestSchema handler that routes to the tool handler.case 'get_blood_expression': return this.handleGetBloodExpression(args);