Skip to main content
Glama
Augmented-Nature

Ensembl MCP Server

translate_sequence

Convert DNA sequences into protein sequences using genetic code tables for biological analysis and research applications.

Instructions

Translate DNA sequence to protein sequence

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sequenceYesDNA sequence to translate
genetic_codeNoGenetic code table (default: 1 for standard)

Implementation Reference

  • The handler function that executes the translate_sequence tool. It cleans the input DNA sequence, translates it to protein using the standard genetic code codon table (ignoring non-ATCG characters, using X for unknown codons), and returns the result in JSON format.
    private async handleTranslateSequence(args: any) {
      try {
        const geneticCode = args.genetic_code || 1;
    
        // Simple translation implementation
        const codonTable: { [key: string]: string } = {
          'TTT': 'F', 'TTC': 'F', 'TTA': 'L', 'TTG': 'L',
          'TCT': 'S', 'TCC': 'S', 'TCA': 'S', 'TCG': 'S',
          'TAT': 'Y', 'TAC': 'Y', 'TAA': '*', 'TAG': '*',
          'TGT': 'C', 'TGC': 'C', 'TGA': '*', 'TGG': 'W',
          'CTT': 'L', 'CTC': 'L', 'CTA': 'L', 'CTG': 'L',
          'CCT': 'P', 'CCC': 'P', 'CCA': 'P', 'CCG': 'P',
          'CAT': 'H', 'CAC': 'H', 'CAA': 'Q', 'CAG': 'Q',
          'CGT': 'R', 'CGC': 'R', 'CGA': 'R', 'CGG': 'R',
          'ATT': 'I', 'ATC': 'I', 'ATA': 'I', 'ATG': 'M',
          'ACT': 'T', 'ACC': 'T', 'ACA': 'T', 'ACG': 'T',
          'AAT': 'N', 'AAC': 'N', 'AAA': 'K', 'AAG': 'K',
          'AGT': 'S', 'AGC': 'S', 'AGA': 'R', 'AGG': 'R',
          'GTT': 'V', 'GTC': 'V', 'GTA': 'V', 'GTG': 'V',
          'GCT': 'A', 'GCC': 'A', 'GCA': 'A', 'GCG': 'A',
          'GAT': 'D', 'GAC': 'D', 'GAA': 'E', 'GAG': 'E',
          'GGT': 'G', 'GGC': 'G', 'GGA': 'G', 'GGG': 'G',
        };
    
        const sequence = args.sequence.toUpperCase().replace(/[^ATCG]/g, '');
        let protein = '';
    
        for (let i = 0; i < sequence.length - 2; i += 3) {
          const codon = sequence.substr(i, 3);
          if (codon.length === 3) {
            protein += codonTable[codon] || 'X';
          }
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                input_sequence: args.sequence,
                cleaned_sequence: sequence,
                protein_sequence: protein,
                genetic_code: geneticCode,
                length: protein.length,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.handleError(error, 'translating sequence');
      }
    }
  • Input schema definition for the translate_sequence tool, specifying the required 'sequence' parameter and optional 'genetic_code'.
      name: 'translate_sequence',
      description: 'Translate DNA sequence to protein sequence',
      inputSchema: {
        type: 'object',
        properties: {
          sequence: { type: 'string', description: 'DNA sequence to translate' },
          genetic_code: { type: 'number', description: 'Genetic code table (default: 1 for standard)', minimum: 1, maximum: 31 },
        },
        required: ['sequence'],
      },
    },
  • src/index.ts:846-847 (registration)
    Registration of the translate_sequence tool handler in the switch statement for CallToolRequestSchema.
    case 'translate_sequence':
      return this.handleTranslateSequence(args);
  • Type guard function for validating input arguments to the translate_sequence tool (defined but not used in the handler).
    const isValidTranslateArgs = (
      args: any
    ): args is { sequence: string; genetic_code?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.sequence === 'string' &&
        args.sequence.length > 0 &&
        (args.genetic_code === undefined || (typeof args.genetic_code === 'number' && args.genetic_code >= 1 && args.genetic_code <= 31))
      );
    };
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe important behavioral aspects: whether this is a read-only operation, what happens with invalid sequences, whether there are rate limits, what the output format looks like, or error conditions. For a bioinformatics tool with no annotation coverage, this represents 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that directly states the tool's function. Every word earns its place with no redundancy or unnecessary elaboration. It's front-loaded with the core purpose and doesn't waste space on obvious information.

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 translation (which involves biological interpretation, genetic codes, and potential edge cases), the description is insufficient. With no annotations, no output schema, and sibling tools that might overlap in functionality, the description doesn't provide enough context for an agent to understand when and how to use this tool effectively. It states what happens but not the broader context of usage.

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 the schema already documents both parameters thoroughly. The description mentions DNA sequence translation but doesn't add any parameter-specific information beyond what's in the schema (like explaining genetic code tables in biological terms or sequence format requirements). This meets the baseline for high schema coverage but doesn't provide additional semantic context.

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: translating DNA sequences to protein sequences. It specifies both the input (DNA sequence) and output (protein sequence), making the verb+resource relationship explicit. However, it doesn't differentiate from sibling tools like 'get_sequence' or 'get_cds_sequence' which might involve sequence retrieval rather than translation.

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. With many sibling tools for sequence-related operations (like get_sequence, get_cds_sequence, get_transcripts), there's no indication of when translation is appropriate versus retrieving sequences or other operations. The description lacks any context about prerequisites or typical use cases.

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

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