search_cancer_markers
Identify proteins linked to specific cancer types or with prognostic significance using Human Protein Atlas data. Filter results by cancer type, prognosis, and output format for tailored analysis.
Instructions
Find proteins associated with specific cancers or with prognostic value
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cancer | No | Cancer type (e.g., breast cancer, lung cancer) | |
| format | No | Output format (default: json) | |
| maxResults | No | Maximum number of results (1-10000, default: 100) | |
| prognostic | No | Prognostic filter |
Implementation Reference
- src/index.ts:1099-1136 (handler)The primary handler function that implements the core logic of the search_cancer_markers tool. It validates input parameters, constructs a specialized search query for cancer types and prognostic values using the Human Protein Atlas API, executes the search via the internal searchProteins method, and returns the results in the MCP format or an error response.private async handleSearchCancerMarkers(args: any) { if (!isValidPathologySearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid pathology search arguments'); } try { let searchQuery = ''; if (args.cancer) { searchQuery = `cancer:"${args.cancer}"`; } if (args.prognostic) { searchQuery += searchQuery ? ` AND prognostic:"${args.prognostic}"` : `prognostic:"${args.prognostic}"`; } if (!searchQuery) { searchQuery = 'prognostic:*'; // Search for any prognostic markers } const result = await this.searchProteins(searchQuery, args.format || 'json', undefined, args.maxResults); return { content: [ { type: 'text', text: typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error searching cancer markers: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:574-587 (registration)The tool registration entry in the ListToolsRequestSchema handler, defining the tool's name, description, and input schema for MCP tool discovery.{ name: 'search_cancer_markers', description: 'Find proteins associated with specific cancers or with prognostic value', inputSchema: { type: 'object', properties: { cancer: { type: 'string', description: 'Cancer type (e.g., breast cancer, lung cancer)' }, prognostic: { type: 'string', enum: ['favorable', 'unfavorable'], description: 'Prognostic filter' }, format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' }, maxResults: { type: 'number', description: 'Maximum number of results (1-10000, default: 100)', minimum: 1, maximum: 10000 }, }, required: [], }, },
- src/index.ts:160-171 (schema)Custom type guard function that validates the input arguments for the search_cancer_markers tool, enforcing the same constraints as the inputSchema (cancer string, prognostic enum, format enum, maxResults 1-10000).const isValidPathologySearchArgs = ( args: any ): args is { cancer?: string; prognostic?: string; format?: string; maxResults?: number } => { return ( typeof args === 'object' && args !== null && (args.cancer === undefined || typeof args.cancer === 'string') && (args.prognostic === undefined || ['favorable', 'unfavorable'].includes(args.prognostic)) && (args.format === undefined || ['json', 'tsv'].includes(args.format)) && (args.maxResults === undefined || (typeof args.maxResults === 'number' && args.maxResults > 0 && args.maxResults <= 10000)) ); };
- src/index.ts:692-693 (registration)The switch case in the CallToolRequestSchema handler that dispatches calls to the search_cancer_markers tool to its handler function.case 'search_cancer_markers': return this.handleSearchCancerMarkers(args);