Skip to main content
Glama

find_pathways_by_gene

Identify pathways associated with a specific gene or protein using gene symbols or UniProt IDs, with species filtering capabilities. Access Reactome's pathway data for biological insights.

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 executes the tool logic: searches for the gene/protein, filters by species if provided, finds pathways containing it via Reactome API, and returns formatted results.
    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, }; } }
  • Tool schema definition including input schema with gene (required) and optional species parameters.
    { 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)
    Tool dispatch/registration in the CallToolRequestSchema switch statement.
    case 'find_pathways_by_gene': return this.handleFindPathwaysByGene(args);
  • src/index.ts:247-258 (registration)
    Tool registration in the ListToolsRequestSchema response, defining name, description, and schema.
    { 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'], }, },
  • Validation helper function for gene arguments used in the handler.
    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') ); };

Other Tools

Related 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