Skip to main content
Glama
Augmented-Nature

Reactome MCP Server

find_pathways_by_disease

Discover biological pathways and mechanisms linked to specific diseases using Reactome pathway data. Input a disease name or DOID identifier to retrieve relevant pathways.

Instructions

Find disease-associated pathways and mechanisms

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
diseaseYesDisease name or DOID identifier
sizeNoNumber of pathways to return (1-100, default: 25)

Implementation Reference

  • The main handler function that implements the core logic for the 'find_pathways_by_disease' tool. It validates input, queries the Reactome search API for pathways matching the disease name, processes the results, and returns formatted pathway information.
    private async handleFindPathwaysByDisease(args: any) {
      if (!isValidDiseaseArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid disease arguments');
      }
    
      try {
        // Search for disease-related pathways
        const searchResponse = await this.apiClient.get('/search/query', {
          params: {
            query: args.disease,
            types: 'Pathway',
            cluster: true
          }
        });
    
        // Extract pathway entries from result groups
        let pathwayEntries: any[] = [];
        if (searchResponse.data.results) {
          for (const group of searchResponse.data.results) {
            if (group.typeName === 'Pathway' && group.entries) {
              pathwayEntries = pathwayEntries.concat(group.entries);
            }
          }
        }
    
        // Limit results if specified
        if (args.size) {
          pathwayEntries = pathwayEntries.slice(0, args.size);
        }
    
        const diseasePathways = {
          disease: args.disease,
          pathwayCount: pathwayEntries.length,
          pathways: pathwayEntries.map((pathway: any) => ({
            id: pathway.stId || pathway.id,
            name: pathway.name?.replace(/<[^>]*>/g, '') || 'Unknown',
            type: pathway.exactType || pathway.typeName || 'Unknown',
            species: Array.isArray(pathway.species) ? pathway.species[0] : pathway.species || 'Unknown',
            description: (pathway.summation?.substring(0, 200) || 'No description available') + '...',
            url: `https://reactome.org/content/detail/${pathway.stId || pathway.id}`
          }))
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(diseasePathways, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error finding pathways by disease: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • The input schema definition for the 'find_pathways_by_disease' tool, registered in the ListToolsRequestSchema handler. Specifies the expected input parameters: disease (required string) and optional size (number).
    {
      name: 'find_pathways_by_disease',
      description: 'Find disease-associated pathways and mechanisms',
      inputSchema: {
        type: 'object',
        properties: {
          disease: { type: 'string', description: 'Disease name or DOID identifier' },
          size: { type: 'number', description: 'Number of pathways to return (1-100, default: 25)', minimum: 1, maximum: 100 },
        },
        required: ['disease'],
      },
    },
  • src/index.ts:333-334 (registration)
    The switch case in the CallToolRequestSchema handler that routes calls to the 'find_pathways_by_disease' tool to its handler method.
    case 'find_pathways_by_disease':
      return this.handleFindPathwaysByDisease(args);
  • Type guard and validation function for the input arguments of the 'find_pathways_by_disease' tool.
    const isValidDiseaseArgs = (args: any): args is { disease: string; size?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.disease === 'string' &&
        args.disease.length > 0 &&
        (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 100))
      );
    };

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