search_cancer_markers
Find proteins linked to specific cancer types or with prognostic significance using Human Protein Atlas data.
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) | |
| prognostic | No | Prognostic filter | |
| format | No | Output format (default: json) | |
| maxResults | No | Maximum number of results (1-10000, default: 100) |
Implementation Reference
- src/index.ts:1099-1136 (handler)The handler function for 'search_cancer_markers' tool. Validates input using isValidPathologySearchArgs, constructs a search query based on cancer type and/or prognostic value, calls the shared searchProteins helper, and formats the response or error.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)Registration of the 'search_cancer_markers' tool in the tools list returned by ListToolsRequestSchema handler, including description and JSON input schema.{ 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)Runtime type guard function used to validate input arguments for the search_cancer_markers handler, matching the inputSchema.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)Switch case in CallToolRequestSchema handler that dispatches calls to 'search_cancer_markers' to the specific handler method.case 'search_cancer_markers': return this.handleSearchCancerMarkers(args);