Skip to main content
Glama
Augmented-Nature

Reactome MCP Server

find_pathways_by_gene

Identify biological pathways associated with a specific gene or protein using Reactome's curated pathway database.

Instructions

Find all pathways containing a specific gene or protein

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geneYesGene symbol or UniProt ID (e.g., BRCA1, P04637)
speciesNoSpecies name or taxon ID (default: Homo sapiens)

Implementation Reference

  • The main handler function that implements the tool logic. Searches for proteins matching the gene, filters by species if provided, then fetches pathways containing that protein using Reactome API.
    private async handleFindPathwaysByGene(args: any) {
      if (!isValidGeneArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid gene arguments');
      }
    
      try {
        // First search for the gene/protein entity
        const searchResponse = await this.apiClient.get('/search/query', {
          params: {
            query: args.gene,
            types: 'Protein',
            cluster: true
          }
        });
    
        // Extract protein entries from result groups
        let proteinEntries: any[] = [];
        if (searchResponse.data.results) {
          for (const group of searchResponse.data.results) {
            if (group.typeName === 'Protein' && group.entries) {
              proteinEntries = proteinEntries.concat(group.entries);
            }
          }
        }
    
        // Filter by species if specified
        if (args.species) {
          proteinEntries = proteinEntries.filter((entry: any) =>
            Array.isArray(entry.species) ?
              entry.species.some((s: string) => s.toLowerCase().includes(args.species!.toLowerCase())) :
              entry.species?.toLowerCase().includes(args.species!.toLowerCase())
          );
        }
    
        if (proteinEntries.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  gene: args.gene,
                  species: args.species || 'Homo sapiens',
                  message: 'No protein entity found for this gene',
                  pathways: []
                }, null, 2),
              },
            ],
          };
        }
    
        // Get the first matching protein
        const protein = proteinEntries[0];
    
        // Find pathways containing this protein
        const pathwaysResponse = await this.apiClient.get(`/data/pathways/low/entity/${protein.stId}`);
    
        const result = {
          gene: args.gene,
          protein: {
            id: protein.stId,
            name: protein.name,
            species: protein.species?.[0]?.name
          },
          pathwayCount: pathwaysResponse.data?.length || 0,
          pathways: pathwaysResponse.data?.map((pathway: any) => ({
            id: pathway.stId,
            name: pathway.name,
            species: pathway.species?.[0]?.name,
            url: `https://reactome.org/content/detail/${pathway.stId}`
          })) || []
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error finding pathways by gene: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the tool, specifying parameters gene (required) and optional species.
    name: 'find_pathways_by_gene',
    description: 'Find all pathways containing a specific gene or protein',
    inputSchema: {
      type: 'object',
      properties: {
        gene: { type: 'string', description: 'Gene symbol or UniProt ID (e.g., BRCA1, P04637)' },
        species: { type: 'string', description: 'Species name or taxon ID (default: Homo sapiens)' },
      },
      required: ['gene'],
    },
  • src/index.ts:331-332 (registration)
    Dispatch registration in the tool call switch statement, routing calls to the handler.
    case 'find_pathways_by_gene':
      return this.handleFindPathwaysByGene(args);
  • Type guard function for validating input arguments matching the schema.
    const isValidGeneArgs = (args: any): args is { gene: string; species?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.gene === 'string' &&
        args.gene.length > 0 &&
        (args.species === undefined || typeof args.species === 'string')
      );
    };
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 states what the tool does but doesn't describe how it behaves—e.g., whether it returns a list, how results are formatted, if there are rate limits, or error conditions. For a query tool with zero annotation coverage, this leaves significant gaps in understanding operational behavior.

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, clear sentence with zero waste—it directly states the tool's function without redundancy or fluff. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly. Every word earns its place.

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 tool's complexity (querying pathways with gene input), lack of annotations, and no output schema, the description is incomplete. It doesn't explain return values, result structure, or potential limitations. For a tool that likely returns structured data, this omission hinders the agent's ability to use it effectively without trial and error.

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 ('gene' and 'species') with examples. The description adds no additional parameter semantics beyond what's in the schema, such as format details or constraints. Baseline 3 is appropriate when the schema does the heavy lifting, but the description doesn't compensate or enhance parameter understanding.

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 as finding pathways containing a specific gene or protein, which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'search_pathways' or 'get_pathway_participants', which might have overlapping functionality. The description is accurate but lacks sibling distinction.

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 'find_pathways_by_disease' or 'search_pathways'. It doesn't mention prerequisites, exclusions, or comparative contexts. The agent must infer usage from the name alone, which is insufficient for optimal tool selection.

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

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