Skip to main content
Glama

ai_process

Automate and coordinate multi-step workflows for file operations, git management, web search, fetching, browser automation, and security analysis by describing your goal in natural language.

Instructions

Primary AI orchestration interface - intelligently processes complex requests by automatically selecting and coordinating multiple tools. Handles file operations, git management, web search, web fetching, browser automation, security analysis, and more. Describe your goal naturally - the AI will determine the best approach and execute multi-step workflows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYesNatural language description of what you want to accomplish. Examples: "Search for React 19 features and analyze code examples", "Find all TypeScript files with TODO comments", "Check git status and create a summary of recent changes", "Fetch the latest Next.js documentation and extract routing information"

Implementation Reference

  • The primary handler function for the 'ai_process' MCP tool. It extracts the natural language request from input arguments, validates it, delegates processing to the AIOrchestrator, and returns the AI-generated response as MCP content.
    export async function handleAIProcess(args: any, aiOrchestrator: AIOrchestrator) {
      try {
        const request = args.request;
        if (!request) {
          throw new Error('Request parameter is required');
        }
    
        logger.info(`Processing AI request: ${request.substring(0, 100)}...`);
    
        const result = await aiOrchestrator.processRequest(request);
    
        return {
          content: [
            {
              type: 'text',
              text: result.response,
            },
          ],
        };
      } catch (error) {
        logger.error('Failed to process AI request:', error as Error);
        return {
          content: [
            {
              type: 'text',
              text: `Error processing request: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Registration of the 'ai_process' tool in the main tool call dispatcher switch statement, routing calls to the handleAIProcess function.
    case 'ai_process':
      return handleAIProcess(args, aiOrchestrator);
  • JSON Schema definition for the 'ai_process' tool input, specifying a required 'request' string parameter with descriptive examples.
    inputSchema: {
      type: 'object',
      properties: {
        request: {
          type: 'string',
          description: 'Natural language description of what you want to accomplish. Examples: "Search for React 19 features and analyze code examples", "Find all TypeScript files with TODO comments", "Check git status and create a summary of recent changes", "Fetch the latest Next.js documentation and extract routing information"',
        },
      },
      required: ['request'],
      additionalProperties: false,
      $schema: 'http://json-schema.org/draft-07/schema#',
    },
  • Tool definition object for 'ai_process' returned by the listTools handler, including name, description, and input schema.
    {
      name: 'ai_process',
      description: 'Primary AI orchestration interface - intelligently processes complex requests by automatically selecting and coordinating multiple tools. Handles file operations, git management, web search, web fetching, browser automation, security analysis, and more. Describe your goal naturally - the AI will determine the best approach and execute multi-step workflows.',
      inputSchema: {
        type: 'object',
        properties: {
          request: {
            type: 'string',
            description: 'Natural language description of what you want to accomplish. Examples: "Search for React 19 features and analyze code examples", "Find all TypeScript files with TODO comments", "Check git status and create a summary of recent changes", "Fetch the latest Next.js documentation and extract routing information"',
          },
        },
        required: ['request'],
        additionalProperties: false,
        $schema: 'http://json-schema.org/draft-07/schema#',
      },
    },
  • Core processing method in AIOrchestrator class called by the tool handler. Orchestrates the AI workflow execution and formats the result with metadata.
    async processRequest(userRequest: string): Promise<AIOrchestrationResult> {
      if (!this.initialized) {
        throw new Error('AI Orchestrator not initialized. Call initialize() first.');
      }
    
      const startTime = Date.now();
      console.error(`πŸ€– AI Processing: "${userRequest}"`);
    
      try {
        // Execute AI-driven workflow
        const workflowResult = await this.workflowEngine.executeWorkflow(userRequest);
        
        const processingTime = Date.now() - startTime;
        const toolsUsed = workflowResult.context.results.map(r => r.tool);
        const successfulSteps = workflowResult.context.results.filter(r => r.success).length;
    
        console.error(`🎯 AI Processing completed in ${processingTime}ms`);
    
        return {
          success: workflowResult.success,
          response: workflowResult.finalResult,
          metadata: {
            processingTime,
            toolsUsed,
            confidence: this.calculateOverallConfidence(workflowResult.context.steps),
            workflowSteps: workflowResult.context.results.length,
            aiEnhanced: true,
          },
          rawResults: workflowResult.context.results.map(r => r.result),
        };
    
      } catch (error) {
        const processingTime = Date.now() - startTime;
        const errorMessage = error instanceof Error ? error.message : String(error);
        
        console.error(`πŸ’₯ AI Processing failed: ${errorMessage}`);
    
        return {
          success: false,
          response: `I encountered an error while processing your request: ${errorMessage}`,
          metadata: {
            processingTime,
            toolsUsed: [],
            confidence: 0,
            workflowSteps: 0,
            aiEnhanced: true,
          },
          error: errorMessage,
        };
      }
    }
Install Server

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/Phoenixrr2113/Orchestrator-MCP'

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