search_by_uniprot
Identify PDB structures linked to a UniProt accession by entering the accession number. Retrieve up to 1,000 results to explore protein data relationships.
Instructions
Find PDB structures associated with a UniProt accession
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of results to return (1-1000, default: 25) | |
| uniprot_id | Yes | UniProt accession number |
Implementation Reference
- src/index.ts:519-566 (handler)The main handler function for the 'search_by_uniprot' tool. It validates the input, constructs a query for the RCSB search API to find PDB structures by UniProt accession, executes the API call, and returns the results as JSON or an error message.private async handleSearchByUniprot(args: any) { if (!args || typeof args.uniprot_id !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Invalid UniProt search arguments'); } try { const searchQuery = { query: { type: "terminal", service: "text", parameters: { attribute: "rcsb_polymer_entity_container_identifiers.reference_sequence_identifiers.database_accession", operator: "exact_match", value: args.uniprot_id } }, return_type: "entry", request_options: { paginate: { start: 0, rows: args.limit || 25 }, results_content_type: ["experimental"] } }; const response = await this.rcsb_apiClient.post('/query', searchQuery); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error searching by UniProt: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:281-292 (registration)Registration of the 'search_by_uniprot' tool in the ListTools response, including name, description, and input schema definition.{ name: 'search_by_uniprot', description: 'Find PDB structures associated with a UniProt accession', inputSchema: { type: 'object', properties: { uniprot_id: { type: 'string', description: 'UniProt accession number' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['uniprot_id'], }, },
- src/index.ts:317-318 (registration)Switch case in the central CallToolRequestSchema handler that dispatches calls to the 'search_by_uniprot' handler function.case 'search_by_uniprot': return this.handleSearchByUniprot(args);
- src/index.ts:284-291 (schema)Input schema definition for the 'search_by_uniprot' tool, specifying required uniprot_id and optional limit.inputSchema: { type: 'object', properties: { uniprot_id: { type: 'string', description: 'UniProt accession number' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['uniprot_id'], },