get_pathway_reactions
Retrieve detailed biochemical reactions for a specific pathway using the pathway stable identifier from Reactome's systems biology data.
Instructions
Get all biochemical reactions within a pathway
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Reactome pathway stable identifier |
Implementation Reference
- src/index.ts:878-941 (handler)Main execution logic for the get_pathway_reactions tool. Validates args, resolves pathway ID, fetches contained events from Reactome API, filters reactions, formats and returns JSON response.private async handleGetPathwayReactions(args: any) { if (!isValidIdArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Pathway ID is required'); } try { // Resolve pathway ID if it's a name const pathwayId = await this.resolvePathwayId(args.id); if (!pathwayId) { return { content: [ { type: 'text', text: JSON.stringify({ error: `No pathway found for identifier: ${args.id}`, suggestion: 'Try using a Reactome stable identifier (e.g., R-HSA-1640170) or search for the pathway first' }, null, 2), }, ], isError: true, }; } const response = await this.apiClient.get(`/data/pathway/${pathwayId}/containedEvents`); // Filter for reactions only const reactions = response.data?.filter((event: any) => event.schemaClass === 'Reaction' || event.schemaClass === 'BlackBoxEvent' ) || []; const pathwayReactions = { pathwayId: pathwayId, originalQuery: args.id, reactionCount: reactions.length, reactions: reactions.map((reaction: any) => ({ id: reaction.stId, name: reaction.name, type: reaction.schemaClass, reversible: reaction.reversible, species: reaction.species?.[0]?.name, url: `https://reactome.org/content/detail/${reaction.stId}` })) }; return { content: [ { type: 'text', text: JSON.stringify(pathwayReactions, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting pathway reactions: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:296-302 (schema)Input schema defining the required 'id' parameter (Reactome pathway stable identifier) for the tool.inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Reactome pathway stable identifier' }, }, required: ['id'], },
- src/index.ts:293-303 (registration)Tool registration entry in the tools list returned by ListToolsRequestSchema, including name, description, and schema.{ name: 'get_pathway_reactions', description: 'Get all biochemical reactions within a pathway', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Reactome pathway stable identifier' }, }, required: ['id'], }, },
- src/index.ts:339-340 (registration)Dispatch switch case in CallToolRequestSchema handler that routes tool calls to the specific handler method.case 'get_pathway_reactions': return this.handleGetPathwayReactions(args);
- src/index.ts:40-47 (helper)Type guard helper function used by the handler to validate pathway ID input arguments.const isValidIdArgs = (args: any): args is { id: string } => { return ( typeof args === 'object' && args !== null && typeof args.id === 'string' && args.id.length > 0 ); };