search_pathways
Find biological pathways in Reactome by searching names, descriptions, or keywords to identify relevant cellular processes and molecular interactions.
Instructions
Search for biological pathways by name, description, or keywords
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query (pathway name, process, keywords) | |
| type | No | Type of entity to search for (default: pathway) | |
| size | No | Number of results to return (1-100, default: 20) |
Implementation Reference
- src/index.ts:352-426 (handler)Main handler function that executes the search_pathways tool: validates args, queries Reactome API /search/query, processes and filters results, formats output.private async handleSearchPathways(args: any) { if (!isValidSearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid search arguments'); } try { const params: any = { query: args.query, cluster: true, }; if (args.type) { params.types = args.type; } const response = await this.apiClient.get('/search/query', { params }); // Extract entries from all result groups let allEntries: any[] = []; if (response.data.results) { for (const group of response.data.results) { if (group.entries) { allEntries = allEntries.concat(group.entries); } } } // Filter by type if specified if (args.type) { const typeFilter = args.type.toLowerCase(); allEntries = allEntries.filter((entry: any) => entry.exactType?.toLowerCase().includes(typeFilter) || entry.typeName?.toLowerCase().includes(typeFilter) ); } // Limit results if specified if (args.size) { allEntries = allEntries.slice(0, args.size); } const formattedResults = { query: args.query, totalResults: response.data.numberOfMatches || 0, returnedResults: allEntries.length, results: allEntries.map((item: any) => ({ id: item.stId || item.id, name: item.name?.replace(/<[^>]*>/g, '') || 'Unknown', // Remove HTML tags type: item.exactType || item.typeName || 'Unknown', species: Array.isArray(item.species) ? item.species[0] : item.species || 'Unknown', description: (item.summation?.substring(0, 200) || 'No description available') + '...', url: `https://reactome.org/content/detail/${item.stId || item.id}` })) }; return { content: [ { type: 'text', text: JSON.stringify(formattedResults, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error searching pathways: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:222-234 (schema)Input schema defining parameters for search_pathways tool: query (required), type (enum), size (1-100).inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (pathway name, process, keywords)' }, type: { type: 'string', enum: ['pathway', 'reaction', 'protein', 'complex', 'disease'], description: 'Type of entity to search for (default: pathway)' }, size: { type: 'number', description: 'Number of results to return (1-100, default: 20)', minimum: 1, maximum: 100 }, }, required: ['query'], },
- src/index.ts:219-235 (registration)Tool registration in ListToolsRequestSchema handler: defines name, description, and inputSchema for search_pathways.{ name: 'search_pathways', description: 'Search for biological pathways by name, description, or keywords', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (pathway name, process, keywords)' }, type: { type: 'string', enum: ['pathway', 'reaction', 'protein', 'complex', 'disease'], description: 'Type of entity to search for (default: pathway)' }, size: { type: 'number', description: 'Number of results to return (1-100, default: 20)', minimum: 1, maximum: 100 }, }, required: ['query'], }, },
- src/index.ts:327-328 (registration)Dispatch registration in CallToolRequestSchema switch statement: routes 'search_pathways' calls to handleSearchPathways.case 'search_pathways': return this.handleSearchPathways(args);