search_proteins
Search the Human Protein Atlas database to find proteins using gene names, protein names, or descriptive keywords. Retrieve detailed expression and localization data in JSON or TSV format.
Instructions
Search Human Protein Atlas for proteins by name, gene symbol, or description
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query (gene name, protein name, or keyword) | |
| format | No | Output format (default: json) | |
| columns | No | Specific columns to include in results | |
| maxResults | No | Maximum number of results (1-10000, default: 100) | |
| compress | No | Whether to compress the response (default: false) |
Implementation Reference
- src/index.ts:809-835 (handler)MCP tool handler for 'search_proteins': validates input using isValidSearchArgs, calls the core searchProteins method, formats response as MCP content or error.private async handleSearchProteins(args: any) { if (!isValidSearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid search arguments'); } try { const result = await this.searchProteins(args.query, args.format || 'json', args.columns, 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 proteins: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:717-736 (helper)Core implementation: performs HTTP GET to Protein Atlas search API with query params, handles JSON/TSV formats, uses default columns for basic info.private async searchProteins(query: string, format: string = 'json', columns?: string[], maxResults?: number): Promise<any> { // Default columns if none provided - basic protein information const defaultColumns = ['g', 'gs', 'eg', 'gd', 'up', 'chr', 'pc', 'pe']; const searchColumns = columns && columns.length > 0 ? columns : defaultColumns; const params: any = { search: query, format: format, columns: searchColumns.join(','), compress: 'no', }; const response = await this.apiClient.get('/api/search_download.php', { params }); if (format === 'json') { return this.parseResponse(response.data, format); } return response.data; }
- src/index.ts:444-458 (registration)Tool registration in ListToolsRequestHandler: defines name, description, and detailed inputSchema for MCP tool discovery.{ name: 'search_proteins', description: 'Search Human Protein Atlas for proteins by name, gene symbol, or description', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (gene name, protein name, or keyword)' }, format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' }, columns: { type: 'array', items: { type: 'string' }, description: 'Specific columns to include in results' }, maxResults: { type: 'number', description: 'Maximum number of results (1-10000, default: 100)', minimum: 1, maximum: 10000 }, compress: { type: 'boolean', description: 'Whether to compress the response (default: false)' }, }, required: ['query'], }, },
- src/index.ts:42-61 (schema)Type guard function for validating input arguments to search_proteins tool, matching the registered inputSchema.const isValidSearchArgs = ( args: any ): args is { query: string; format?: string; columns?: string[]; compress?: boolean; maxResults?: number; } => { return ( typeof args === 'object' && args !== null && typeof args.query === 'string' && args.query.length > 0 && (args.format === undefined || ['json', 'tsv', 'xml', 'trig'].includes(args.format)) && (args.columns === undefined || Array.isArray(args.columns)) && (args.compress === undefined || typeof args.compress === 'boolean') && (args.maxResults === undefined || (typeof args.maxResults === 'number' && args.maxResults > 0 && args.maxResults <= 10000)) ); };