get_structure_info
Retrieve detailed structural data for a specific protein or nucleic acid from the Protein Data Bank using its PDB ID.
Instructions
Get detailed information for a specific PDB structure
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pdb_id | Yes | PDB ID (4-character code, e.g., 1ABC) | |
| format | No | Output format (default: json) |
Implementation Reference
- src/index.ts:429-475 (handler)Executes the 'get_structure_info' tool: validates input, fetches PDB structure data from RCSB API in specified format (JSON or file), handles errors.private async handleGetStructureInfo(args: any) { if (!isValidPDBIdArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid PDB ID arguments'); } try { const pdbId = args.pdb_id.toLowerCase(); const format = args.format || 'json'; if (format === 'json') { const response = await this.apiClient.get(`/core/entry/${pdbId}`); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } else { // Handle file format downloads const baseUrl = 'https://files.rcsb.org/download'; const extension = format === 'mmcif' ? 'cif' : format; const url = `${baseUrl}/${pdbId}.${extension}`; const response = await axios.get(url); return { content: [ { type: 'text', text: response.data, }, ], }; } } catch (error) { return { content: [ { type: 'text', text: `Error fetching structure info: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:256-267 (registration)Registers the 'get_structure_info' tool in ListTools response with name, description, and input schema.{ name: 'get_structure_info', description: 'Get detailed information for a specific PDB structure', inputSchema: { type: 'object', properties: { pdb_id: { type: 'string', description: 'PDB ID (4-character code, e.g., 1ABC)' }, format: { type: 'string', enum: ['json', 'pdb', 'mmcif', 'xml'], description: 'Output format (default: json)' }, }, required: ['pdb_id'], }, },
- src/index.ts:313-314 (registration)Dispatches tool calls for 'get_structure_info' to the handler in CallToolRequestSchema handler.case 'get_structure_info': return this.handleGetStructureInfo(args);
- src/index.ts:38-48 (helper)Helper function to validate input arguments for the 'get_structure_info' tool (PDB ID format and optional format).const isValidPDBIdArgs = ( args: any ): args is { pdb_id: string; format?: 'json' | 'pdb' | 'mmcif' | 'xml' } => { return ( typeof args === 'object' && args !== null && typeof args.pdb_id === 'string' && args.pdb_id.length === 4 && /^[0-9][a-zA-Z0-9]{3}$/i.test(args.pdb_id) && (args.format === undefined || ['json', 'pdb', 'mmcif', 'xml'].includes(args.format)) );