get_protein_structure
Retrieve 3D protein structure data from PDB using a UniProt accession number to analyze and visualize molecular configurations.
Instructions
Retrieve 3D structure information from PDB references
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accession | Yes | UniProt accession number |
Implementation Reference
- src/index.ts:1178-1217 (handler)The handler function that implements the get_protein_structure tool. Fetches protein data from UniProt API and extracts PDB cross-references, structural features (helix, strand, etc.), and subunit comments.private async handleGetProteinStructure(args: any) { if (!isValidProteinInfoArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid protein structure arguments'); } try { const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, { params: { format: 'json' }, }); const protein = response.data; const structureInfo = { accession: protein.primaryAccession, pdbReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'PDB') || [], structuralFeatures: protein.features?.filter((f: any) => ['Secondary structure', 'Turn', 'Helix', 'Beta strand'].includes(f.type) ) || [], structuralComments: protein.comments?.filter((c: any) => c.commentType === 'SUBUNIT') || [], }; return { content: [ { type: 'text', text: JSON.stringify(structureInfo, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching protein structure: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:513-522 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: 'get_protein_structure', description: 'Retrieve 3D structure information from PDB references', inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number' }, }, required: ['accession'], },
- src/index.ts:748-749 (registration)Dispatch case in the CallToolRequest handler that routes to the tool's handler function.case 'get_protein_structure': return this.handleGetProteinStructure(args);
- src/index.ts:79-89 (schema)Input validation function used by get_protein_structure (and others) to validate accession and optional format.const isValidProteinInfoArgs = ( args: any ): args is { accession: string; format?: string } => { return ( typeof args === 'object' && args !== null && typeof args.accession === 'string' && args.accession.length > 0 && (args.format === undefined || ['json', 'tsv', 'fasta', 'xml'].includes(args.format)) ); };