Skip to main content
Glama

compare_proteins

Compare multiple protein sequences and features side-by-side using UniProt accession numbers to analyze similarities and differences.

Instructions

Compare multiple proteins side-by-side with sequence and feature comparison

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accessionsYesArray of UniProt accession numbers (2-10)
formatNoOutput format (default: json)

Implementation Reference

  • The handler function for the 'compare_proteins' tool. Validates input, fetches UniProt data for each accession, extracts key properties (accession, name, organism, sequence length, molecular weight, feature count, domain count), compiles a comparison array, and returns it as JSON.
    private async handleCompareProteins(args: any) {
      if (!isValidCompareProteinsArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid compare proteins arguments');
      }
    
      try {
        const comparisons = [];
        for (const accession of args.accessions) {
          const response = await this.apiClient.get(`/uniprotkb/${accession}`, {
            params: { format: 'json' },
          });
          const protein = response.data;
          comparisons.push({
            accession: protein.primaryAccession,
            name: protein.uniProtkbId,
            organism: protein.organism?.scientificName,
            length: protein.sequence?.length,
            mass: protein.sequence?.molWeight,
            features: protein.features?.length || 0,
            domains: protein.features?.filter((f: any) => f.type === 'Domain').length || 0,
          });
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ comparison: comparisons }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error comparing proteins: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • src/index.ts:739-740 (registration)
    Registers the handler for 'compare_proteins' in the CallToolRequestSchema switch statement.
    case 'compare_proteins':
      return this.handleCompareProteins(args);
  • src/index.ts:464-474 (registration)
    Registers the 'compare_proteins' tool in the ListToolsRequestSchema response, including name, description, and input schema.
      name: 'compare_proteins',
      description: 'Compare multiple proteins side-by-side with sequence and feature comparison',
      inputSchema: {
        type: 'object',
        properties: {
          accessions: { type: 'array', items: { type: 'string' }, description: 'Array of UniProt accession numbers (2-10)', minItems: 2, maxItems: 10 },
          format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' },
        },
        required: ['accessions'],
      },
    },
  • Input validation type guard function for 'compare_proteins' tool arguments, checking accessions array (2-10 strings) and optional format.
    const isValidCompareProteinsArgs = (
      args: any
    ): args is { accessions: string[]; format?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        Array.isArray(args.accessions) &&
        args.accessions.length > 1 &&
        args.accessions.length <= 10 &&
        args.accessions.every((acc: any) => typeof acc === 'string' && acc.length > 0) &&
        (args.format === undefined || ['json', 'tsv'].includes(args.format))
      );
    };
Behavior2/5

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

With no annotations provided, the description carries full burden but only mentions the comparison functionality without behavioral details. It doesn't disclose rate limits, authentication requirements, whether it's read-only or has side effects, or what the comparison output looks like (beyond format options in schema).

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 clearly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded with the core functionality.

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

Completeness3/5

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

For a 2-parameter tool with no annotations and no output schema, the description is minimally adequate but lacks important context. It doesn't explain what 'feature comparison' includes, how results are structured, or any limitations beyond the parameter constraints in the schema.

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?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description adds no additional parameter semantics beyond what's in the schema (e.g., doesn't explain what 'feature comparison' entails or how accessions should be formatted). Baseline 3 is appropriate when schema does the heavy lifting.

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 ('compare') and resource ('multiple proteins') with specific comparison aspects ('sequence and feature comparison'). It distinguishes from siblings like 'get_protein_sequence' or 'get_protein_features' by emphasizing side-by-side comparison of multiple proteins, though it doesn't explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for comparing multiple proteins, but doesn't explicitly state when to use this versus alternatives like 'get_protein_homologs' for evolutionary comparisons or 'batch_protein_lookup' for basic data retrieval. No guidance on prerequisites or exclusions is provided.

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