Skip to main content
Glama

get_protein_structure

Retrieve 3D protein structure information from PDB references using a UniProt accession number to visualize molecular architecture.

Instructions

Retrieve 3D structure information from PDB references

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accessionYesUniProt accession number

Implementation Reference

  • The handler function for 'get_protein_structure' tool. Fetches UniProt protein data and extracts PDB cross-references, structural features, and subunit comments.
    private async handleGetProteinStructure(args: any) {
      if (!isValidProteinInfoArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid protein structure arguments');
      }
    
      try {
        const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, {
          params: { format: 'json' },
        });
    
        const protein = response.data;
        const structureInfo = {
          accession: protein.primaryAccession,
          pdbReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'PDB') || [],
          structuralFeatures: protein.features?.filter((f: any) =>
            ['Secondary structure', 'Turn', 'Helix', 'Beta strand'].includes(f.type)
          ) || [],
          structuralComments: protein.comments?.filter((c: any) => c.commentType === 'SUBUNIT') || [],
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(structureInfo, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching protein structure: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema for the 'get_protein_structure' tool, defining the required 'accession' parameter.
    // Structure & Function Analysis Tools
    {
      name: 'get_protein_structure',
      description: 'Retrieve 3D structure information from PDB references',
      inputSchema: {
        type: 'object',
        properties: {
          accession: { type: 'string', description: 'UniProt accession number' },
        },
        required: ['accession'],
      },
  • src/index.ts:748-749 (registration)
    Registration of the tool handler in the CallToolRequestSchema switch statement.
    case 'get_protein_structure':
      return this.handleGetProteinStructure(args);
  • Helper validation function used by 'get_protein_structure' to validate input arguments.
    const isValidProteinInfoArgs = (
      args: any
    ): args is { accession: string; format?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.accession === 'string' &&
        args.accession.length > 0 &&
        (args.format === undefined || ['json', 'tsv', 'fasta', 'xml'].includes(args.format))
      );
    };

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/UniProt-MCP-Server'

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