Skip to main content
Glama

download_structure

Retrieve protein structure coordinates in PDB, mmCIF, MMTF, or XML formats by specifying the PDB ID and optional biological assembly ID.

Instructions

Download structure coordinates in various formats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assembly_idNoBiological assembly ID (optional)
formatNoFile format (default: pdb)
pdb_idYesPDB ID (4-character code)

Implementation Reference

  • The handler function that validates arguments, constructs the download URL for the specified PDB structure (with optional assembly), fetches the file using axios from RCSB files server, and returns the content or error.
    private async handleDownloadStructure(args: any) { if (!isValidDownloadArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid download structure arguments'); } try { const pdbId = args.pdb_id.toLowerCase(); const format = args.format || 'pdb'; const assemblyId = args.assembly_id; let url: string; if (assemblyId) { const extension = format === 'mmcif' ? 'cif' : format; url = `https://files.rcsb.org/download/${pdbId}-assembly${assemblyId}.${extension}`; } else { const extension = format === 'mmcif' ? 'cif' : format; url = `https://files.rcsb.org/download/${pdbId}.${extension}`; } const response = await axios.get(url); return { content: [ { type: 'text', text: `Structure file for ${args.pdb_id} (${format.toUpperCase()} format)${assemblyId ? ` - Assembly ${assemblyId}` : ''}:\n\n${response.data}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error downloading structure: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; }
  • The input schema for the download_structure tool, defining required pdb_id and optional format and assembly_id parameters.
    name: 'download_structure', description: 'Download structure coordinates in various formats', inputSchema: { type: 'object', properties: { pdb_id: { type: 'string', description: 'PDB ID (4-character code)' }, format: { type: 'string', enum: ['pdb', 'mmcif', 'mmtf', 'xml'], description: 'File format (default: pdb)' }, assembly_id: { type: 'string', description: 'Biological assembly ID (optional)' }, }, required: ['pdb_id'], }, },
  • src/index.ts:315-316 (registration)
    Switch case in the CallToolRequestHandler that registers and routes calls to 'download_structure' to its handler method.
    case 'download_structure': return this.handleDownloadStructure(args);
  • Type guard helper function that validates the arguments for download_structure: checks PDB ID format, valid format enum, and string assembly_id.
    const isValidDownloadArgs = ( args: any ): args is { pdb_id: string; format?: 'pdb' | 'mmcif' | 'mmtf' | 'xml'; assembly_id?: string } => { 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 || ['pdb', 'mmcif', 'mmtf', 'xml'].includes(args.format)) && (args.assembly_id === undefined || typeof args.assembly_id === 'string') ); };

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Augmented-Nature/PDB-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server