Skip to main content
Glama
Augmented-Nature

PDB MCP Server

download_structure

Download protein structure coordinates from the Protein Data Bank in PDB, mmCIF, MMTF, or XML formats for analysis and visualization.

Instructions

Download structure coordinates in various formats

Input Schema

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

Implementation Reference

  • The handler function for the 'download_structure' tool. Validates input arguments, constructs the appropriate download URL for the PDB structure (handling formats like PDB, mmCIF, MMTF, XML and optional biological assemblies), fetches the file using axios, and returns the content wrapped in MCP tool response format.
    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,
        };
      }
    }
  • src/index.ts:268-280 (registration)
    Registration of the 'download_structure' tool in the ListToolsRequestSchema response, including name, description, and JSON input schema definition.
    {
      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'],
      },
    },
  • Type guard function (input validation schema) specifically for 'download_structure' tool arguments, enforcing PDB ID format and allowed formats/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')
      );
    };
  • src/index.ts:315-316 (registration)
    Dispatcher case in CallToolRequestSchema handler that routes 'download_structure' calls to the handleDownloadStructure method.
    case 'download_structure':
      return this.handleDownloadStructure(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but lacks behavioral details. It doesn't disclose whether this is a read-only operation (implied by 'download'), authentication requirements, rate limits, file size considerations, or what happens on failure (e.g., invalid PDB ID). The phrase 'various formats' is vague without context on format differences.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It avoids redundancy but could be slightly more informative (e.g., specifying typical use cases). Every word earns its place, though it's borderline minimal.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 3 parameters with full schema coverage and no output schema, the description is adequate but incomplete. It covers the basic purpose but lacks context on behavioral traits (e.g., network effects, error handling) and usage guidelines, which are important for a download operation with format options and no annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents parameters. The description adds no additional meaning beyond implying format flexibility ('various formats'), which is already covered by the enum in the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Download') and resource ('structure coordinates'), specifying the resource type and output format variability. It distinguishes from siblings like 'get_structure_info' (metadata retrieval) and 'get_structure_quality' (quality metrics) by focusing on file download, though it doesn't explicitly name these alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description mentions 'various formats' but doesn't specify which format to choose for different use cases or compare to sibling tools like 'search_structures' for finding structures before downloading.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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