get_subcellular_location
Retrieve subcellular localization data for proteins to understand their cellular distribution and function using Human Protein Atlas information.
Instructions
Get subcellular localization 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:1010-1036 (handler)The main handler function for the 'get_subcellular_location' tool. Validates input using isValidGeneArgs, fetches data via fetchSubcellularLocalization, and returns JSON-formatted subcellular location data or an error.private async handleGetSubcellularLocation(args: any) { if (!isValidGeneArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid gene arguments'); } try { const result = await this.fetchSubcellularLocalization(args.gene); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching subcellular location: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:538-545 (schema)Input schema definition for the tool, specifying required 'gene' parameter 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:535-546 (registration)Tool registration in the ListToolsRequestSchema handler, defining name, description, and input schema.{ name: 'get_subcellular_location', description: 'Get subcellular localization 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:685-686 (registration)Dispatch case in the CallToolRequestSchema switch statement that routes to the handler.case 'get_subcellular_location': return this.handleGetSubcellularLocation(args);
- src/index.ts:753-756 (helper)Helper method that fetches subcellular location data by calling searchProteins with specific columns: scl (subcell location), scml (main location), scal (additional locations), relce (reliability).private async fetchSubcellularLocalization(gene: string): Promise<any> { const columns = ['g', 'eg', 'scl', 'scml', 'scal', 'relce']; return this.searchProteins(gene, 'json', columns, 1); }