Skip to main content
Glama
Augmented-Nature

PDB MCP Server

search_by_uniprot

Find PDB structures linked to a UniProt accession number to analyze protein structures in the Protein Data Bank.

Instructions

Find PDB structures associated with a UniProt accession

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uniprot_idYesUniProt accession number
limitNoNumber of results to return (1-1000, default: 25)

Implementation Reference

  • The handler function that executes the search_by_uniprot tool logic. It validates input, constructs a query for RCSB search API using UniProt ID, fetches results, and returns formatted JSON or error.
    private async handleSearchByUniprot(args: any) {
      if (!args || typeof args.uniprot_id !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid UniProt search arguments');
      }
    
      try {
        const searchQuery = {
          query: {
            type: "terminal",
            service: "text",
            parameters: {
              attribute: "rcsb_polymer_entity_container_identifiers.reference_sequence_identifiers.database_accession",
              operator: "exact_match",
              value: args.uniprot_id
            }
          },
          return_type: "entry",
          request_options: {
            paginate: {
              start: 0,
              rows: args.limit || 25
            },
            results_content_type: ["experimental"]
          }
        };
    
        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 by UniProt: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema defining parameters for the search_by_uniprot tool: uniprot_id (required string) and optional limit.
    inputSchema: {
      type: 'object',
      properties: {
        uniprot_id: { type: 'string', description: 'UniProt accession number' },
        limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
      },
      required: ['uniprot_id'],
    },
  • src/index.ts:281-292 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    {
      name: 'search_by_uniprot',
      description: 'Find PDB structures associated with a UniProt accession',
      inputSchema: {
        type: 'object',
        properties: {
          uniprot_id: { type: 'string', description: 'UniProt accession number' },
          limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
        },
        required: ['uniprot_id'],
      },
    },
  • src/index.ts:317-318 (registration)
    Dispatch case in CallToolRequest handler that routes to the search_by_uniprot handler function.
    case 'search_by_uniprot':
      return this.handleSearchByUniprot(args);

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