Skip to main content
Glama
Augmented-Nature

PDB MCP Server

search_structures

Find protein structures in the PDB database using keywords, protein names, or PDB IDs. Filter results by experimental method, resolution range, and sort criteria to locate specific structural data.

Instructions

Search PDB database for protein structures by keyword, protein name, or PDB ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (protein name, keyword, PDB ID, etc.)
limitNoNumber of results to return (1-1000, default: 25)
sort_byNoSort results by (release_date, resolution, etc.)
experimental_methodNoFilter by experimental method (X-RAY, NMR, ELECTRON MICROSCOPY)
resolution_rangeNoResolution range filter (e.g., "1.0-2.0")

Implementation Reference

  • The main handler function for 'search_structures' tool. Validates input, constructs RCSB search API query with full-text search and optional filters for experimental method and resolution range, executes POST to /query endpoint, and returns JSON results or error message.
    private async handleSearchStructures(args: any) {
      if (!isValidSearchArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid search arguments');
      }
    
      try {
        const searchQuery: any = {
          query: {
            type: "terminal",
            service: "full_text",
            parameters: {
              value: args.query
            }
          },
          return_type: "entry",
          request_options: {
            paginate: {
              start: 0,
              rows: args.limit || 25
            },
            results_content_type: ["experimental"],
            sort: [
              {
                sort_by: args.sort_by || "score",
                direction: "desc"
              }
            ]
          }
        };
    
        // Add filters if provided
        if (args.experimental_method || args.resolution_range) {
          const filters = [];
    
          if (args.experimental_method) {
            filters.push({
              type: "terminal",
              service: "text",
              parameters: {
                attribute: "exptl.method",
                operator: "exact_match",
                value: args.experimental_method
              }
            });
          }
    
          if (args.resolution_range) {
            const [min, max] = args.resolution_range.split('-').map(Number);
            if (min && max) {
              filters.push({
                type: "terminal",
                service: "text",
                parameters: {
                  attribute: "rcsb_entry_info.resolution_combined",
                  operator: "range",
                  value: {
                    from: min,
                    to: max,
                    include_lower: true,
                    include_upper: true
                  }
                }
              });
            }
          }
    
          if (filters.length > 0) {
            searchQuery.query = {
              type: "group",
              logical_operator: "and",
              nodes: [searchQuery.query, ...filters]
            };
          }
        }
    
        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 structures: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the 'search_structures' tool, specifying parameters like query (required), limit, sort_by, experimental_method, and resolution_range.
    inputSchema: {
      type: 'object',
      properties: {
        query: { type: 'string', description: 'Search query (protein name, keyword, PDB ID, etc.)' },
        limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
        sort_by: { type: 'string', description: 'Sort results by (release_date, resolution, etc.)' },
        experimental_method: { type: 'string', description: 'Filter by experimental method (X-RAY, NMR, ELECTRON MICROSCOPY)' },
        resolution_range: { type: 'string', description: 'Resolution range filter (e.g., "1.0-2.0")' },
      },
      required: ['query'],
    },
  • src/index.ts:241-255 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining name, description, and inputSchema for 'search_structures'.
    {
      name: 'search_structures',
      description: 'Search PDB database for protein structures by keyword, protein name, or PDB ID',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'Search query (protein name, keyword, PDB ID, etc.)' },
          limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          sort_by: { type: 'string', description: 'Sort results by (release_date, resolution, etc.)' },
          experimental_method: { type: 'string', description: 'Filter by experimental method (X-RAY, NMR, ELECTRON MICROSCOPY)' },
          resolution_range: { type: 'string', description: 'Resolution range filter (e.g., "1.0-2.0")' },
        },
        required: ['query'],
      },
    },
  • Type guard and validation function for search_structures input arguments, used in the handler to validate params before processing.
    const isValidSearchArgs = (
      args: any
    ): args is { query: string; limit?: number; sort_by?: string; experimental_method?: string; resolution_range?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.query === 'string' &&
        args.query.length > 0 &&
        (args.limit === undefined || (typeof args.limit === 'number' && args.limit > 0 && args.limit <= 1000)) &&
        (args.sort_by === undefined || typeof args.sort_by === 'string') &&
        (args.experimental_method === undefined || typeof args.experimental_method === 'string') &&
        (args.resolution_range === undefined || typeof args.resolution_range === 'string')
      );
    };
  • src/index.ts:311-312 (registration)
    Dispatch case in CallToolRequestSchema handler that routes calls to 'search_structures' to the handleSearchStructures method.
    case 'search_structures':
      return this.handleSearchStructures(args);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions searching but doesn't cover critical aspects like whether this is a read-only operation, potential rate limits, authentication needs, or what the response format looks like (e.g., list of structures with metadata). For a search tool with 5 parameters, this leaves significant gaps.

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

Conciseness5/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 without unnecessary words. Every part ('search PDB database', 'protein structures', 'by keyword, protein name, or PDB ID') contributes directly to understanding the tool's function.

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

Completeness2/5

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

Given the complexity (5 parameters, no annotations, no output schema), the description is incomplete. It lacks information about behavioral traits, output format, and usage context relative to siblings. While concise, it doesn't provide enough detail for an agent to fully understand how to invoke and interpret results from this tool.

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?

The description implies the 'query' parameter's purpose but doesn't add meaningful semantics beyond what the schema already provides. With 100% schema description coverage, the baseline is 3, as the schema adequately documents all parameters (e.g., 'limit' range, 'experimental_method' values). No extra parameter insights are offered.

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 ('search'), resource ('PDB database for protein structures'), and search methods ('by keyword, protein name, or PDB ID'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'search_by_uniprot' or 'get_structure_info', which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'search_by_uniprot' or 'get_structure_info', nor does it mention prerequisites or exclusions. It simply states what the tool does without contextual usage information.

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