Skip to main content
Glama

analyze_sequence_composition

Analyze protein sequence properties like amino acid composition and hydrophobicity using a UniProt accession number to understand structural characteristics.

Instructions

Amino acid composition, hydrophobicity, and other sequence properties

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accessionYesUniProt accession number

Implementation Reference

  • Main handler function that implements the tool logic: fetches protein sequence from UniProtKB API, calculates amino acid counts, frequencies, and categorizes residues (hydrophobic, charged, polar).
    private async handleAnalyzeSequenceComposition(args: any) {
      if (!isValidProteinInfoArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid sequence composition arguments');
      }
    
      try {
        const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, {
          params: { format: 'json' },
        });
    
        const protein = response.data;
        const sequence = protein.sequence?.value || '';
    
        // Calculate amino acid composition
        const aaCount: { [key: string]: number } = {};
        const aaFreq: { [key: string]: number } = {};
    
        for (const aa of sequence) {
          aaCount[aa] = (aaCount[aa] || 0) + 1;
        }
    
        for (const aa in aaCount) {
          aaFreq[aa] = aaCount[aa] / sequence.length;
        }
    
        const composition = {
          accession: protein.primaryAccession,
          sequenceLength: sequence.length,
          molecularWeight: protein.sequence?.molWeight,
          aminoAcidComposition: aaCount,
          aminoAcidFrequency: aaFreq,
          hydrophobicResidues: ['A', 'I', 'L', 'M', 'F', 'W', 'Y', 'V'].reduce((sum, aa) => sum + (aaCount[aa] || 0), 0),
          chargedResidues: ['R', 'H', 'K', 'D', 'E'].reduce((sum, aa) => sum + (aaCount[aa] || 0), 0),
          polarResidues: ['S', 'T', 'N', 'Q'].reduce((sum, aa) => sum + (aaCount[aa] || 0), 0),
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(composition, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error analyzing sequence composition: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema for the tool defining the required 'accession' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        accession: { type: 'string', description: 'UniProt accession number' },
      },
      required: ['accession'],
    },
  • src/index.ts:754-755 (registration)
    Registration and dispatch of the tool handler in the CallToolRequestSchema switch statement.
    case 'analyze_sequence_composition':
      return this.handleAnalyzeSequenceComposition(args);
  • src/index.ts:547-556 (registration)
    Tool registration in the ListToolsRequestSchema response, including name, description, and schema.
      name: 'analyze_sequence_composition',
      description: 'Amino acid composition, hydrophobicity, and other sequence properties',
      inputSchema: {
        type: 'object',
        properties: {
          accession: { type: 'string', description: 'UniProt accession number' },
        },
        required: ['accession'],
      },
    },
  • Shared validation function for accession-based arguments, used in the handler for input validation.
    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))
      );
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the types of properties analyzed (amino acid composition, hydrophobicity, etc.) but lacks critical details: whether this is a read-only operation, computational requirements, potential rate limits, or what the output looks like (e.g., numerical values, plots). For a tool with no annotation coverage, this is a significant gap in transparency.

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 lists key analysis types without unnecessary words. It's front-loaded with the core purpose, though it could be slightly more structured by explicitly mentioning the input or output. Overall, it's concise and avoids redundancy, earning a high score for brevity and clarity.

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 of sequence analysis and the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., a report, JSON object, or visual summary), how properties are calculated, or any limitations (e.g., supported sequence types). For a tool that likely involves computational analysis, this leaves too much unspecified for effective use.

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 input schema has 100% description coverage, with the single parameter 'accession' documented as a UniProt accession number. The description adds no additional parameter semantics beyond what the schema provides—it doesn't explain how the accession is used to derive the analysis or any constraints (e.g., valid formats). Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't detract either.

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 tool's purpose: analyzing amino acid composition, hydrophobicity, and other sequence properties. It specifies the verb 'analyze' and the resource 'sequence properties', distinguishing it from siblings like get_protein_sequence (which retrieves raw sequence) or get_protein_info (which provides general metadata). However, it doesn't explicitly mention the input (accession number) or output format, leaving some ambiguity.

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. It doesn't specify scenarios where this analysis is needed (e.g., for protein characterization vs. structural prediction) or differentiate it from siblings like get_protein_features (which might include some overlapping properties). Without such context, users must infer usage based on the tool name alone.

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

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