Skip to main content
Glama
Augmented-Nature

STRING-db MCP Server

find_homologs

Identify homologous proteins across species using STRING-db to analyze evolutionary relationships and functional conservation in protein networks.

Instructions

Find homologous proteins across different species

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protein_idYesProtein identifier (gene name, UniProt ID, or STRING ID)
speciesNoSource species name or NCBI taxonomy ID (default: 9606 for human)
target_speciesNoTarget species to search for homologs (optional)

Implementation Reference

  • The main handler function for the 'find_homologs' tool. Validates input using isValidHomologyArgs, calls the STRING API '/tsv/homology' endpoint, parses the TSV response into HomologyResult objects using parseTsvData, groups results by species, and returns a formatted JSON response with homologs organized by species.
    private async handleFindHomologs(args: any) {
      if (!isValidHomologyArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid homology arguments');
      }
    
      try {
        const species = args.species || '9606';
    
        const params: any = {
          identifiers: args.protein_id,
          species: species,
        };
    
        if (args.target_species) {
          params.target_species = args.target_species.join(',');
        }
    
        const response = await this.apiClient.get('/tsv/homology', { params });
    
        const homologs = this.parseTsvData<HomologyResult>(response.data);
    
        // Group by species
        const groupedHomologs: Record<string, HomologyResult[]> = {};
        homologs.forEach(homolog => {
          const speciesKey = `${homolog.ncbiTaxonId}_${homolog.taxonName}`;
          if (!groupedHomologs[speciesKey]) {
            groupedHomologs[speciesKey] = [];
          }
          groupedHomologs[speciesKey].push(homolog);
        });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                query_protein: args.protein_id,
                source_species: species,
                total_homologs: homologs.length,
                species_count: Object.keys(groupedHomologs).length,
                homologs_by_species: groupedHomologs,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error finding homologs: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • src/index.ts:362-374 (registration)
    Registration of the 'find_homologs' tool in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema returned to clients.
    {
      name: 'find_homologs',
      description: 'Find homologous proteins across different species',
      inputSchema: {
        type: 'object',
        properties: {
          protein_id: { type: 'string', description: 'Protein identifier (gene name, UniProt ID, or STRING ID)' },
          species: { type: 'string', description: 'Source species name or NCBI taxonomy ID (default: 9606 for human)' },
          target_species: { type: 'array', items: { type: 'string' }, description: 'Target species to search for homologs (optional)' },
        },
        required: ['protein_id'],
      },
    },
  • Input validation function (type guard) for 'find_homologs' tool arguments, ensuring protein_id is a non-empty string, species is optional string, and target_species is optional array of strings.
    const isValidHomologyArgs = (
      args: any
    ): args is { protein_id: string; species?: string; target_species?: string[] } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.protein_id === 'string' &&
        args.protein_id.length > 0 &&
        (args.species === undefined || typeof args.species === 'string') &&
        (args.target_species === undefined ||
         (Array.isArray(args.target_species) &&
          args.target_species.every((sp: any) => typeof sp === 'string')))
      );
    };
  • TypeScript interface defining the structure of individual homology results used by the parseTsvData function and handler response.
    interface HomologyResult {
      stringId: string;
      ncbiTaxonId: number;
      taxonName: string;
      preferredName: string;
      annotation: string;
    }
  • src/index.ts:403-404 (registration)
    Dispatcher case in CallToolRequestSchema handler that routes 'find_homologs' tool calls to the handleFindHomologs method.
    case 'find_homologs':
      return this.handleFindHomologs(args);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but reveals nothing about performance characteristics (e.g., speed, accuracy), data sources, limitations (e.g., coverage gaps), or what the output looks like (format, structure). For a bioinformatics tool with potentially complex behavior, this is insufficient.

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 gets straight to the point with zero wasted words. It's appropriately sized for a tool with clear parameters documented elsewhere and follows good front-loading principles.

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 homology search (which involves algorithms, databases, and potential limitations) and the absence of both annotations and an output schema, the description is incomplete. It doesn't help an agent understand what to expect from the tool's behavior or results, which is particularly important for scientific tools where accuracy and methodology matter.

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 all three parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain what constitutes a 'homolog', how homology is determined, or format examples). Baseline 3 is appropriate when the 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 ('Find') and resource ('homologous proteins across different species'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'search_proteins' or 'get_protein_annotations', but the focus on cross-species homology is specific enough for basic understanding.

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 like 'search_proteins' or 'get_protein_annotations'. It doesn't mention prerequisites, limitations, or typical use cases, leaving the agent to infer usage from 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/STRING-db-MCP-Server'

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