Skip to main content
Glama

get_protein_variants

Retrieve disease-associated variants and mutations for a protein using its UniProt accession number to analyze genetic variations.

Instructions

Disease-associated variants and mutations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accessionYesUniProt accession number

Implementation Reference

  • The main handler function for the 'get_protein_variants' tool. Fetches protein data from UniProt API and extracts variant information including natural variants, mutagenesis sites, disease-associated variants, and polymorphisms.
    private async handleGetProteinVariants(args: any) {
      if (!isValidProteinInfoArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid protein variants arguments');
      }
    
      try {
        const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, {
          params: { format: 'json' },
        });
    
        const protein = response.data;
        const variantInfo = {
          accession: protein.primaryAccession,
          naturalVariants: protein.features?.filter((f: any) => f.type === 'Natural variant') || [],
          mutagenesisFeatures: protein.features?.filter((f: any) => f.type === 'Mutagenesis') || [],
          diseaseVariants: protein.features?.filter((f: any) =>
            f.type === 'Natural variant' && f.association?.disease
          ) || [],
          polymorphisms: protein.comments?.filter((c: any) => c.commentType === 'POLYMORPHISM') || [],
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(variantInfo, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching protein variants: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • src/index.ts:536-544 (registration)
    Tool registration in the ListToolsRequestSchema handler, including name, description, and input schema.
    name: 'get_protein_variants',
    description: 'Disease-associated variants and mutations',
    inputSchema: {
      type: 'object',
      properties: {
        accession: { type: 'string', description: 'UniProt accession number' },
      },
      required: ['accession'],
    },
  • src/index.ts:752-753 (registration)
    Dispatch case in the CallToolRequestSchema switch statement that routes calls to the handler.
    case 'get_protein_variants':
      return this.handleGetProteinVariants(args);
  • Input validation helper function used by get_protein_variants and other protein info tools.
    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