Skip to main content
Glama

jules_analyze_code

Analyze code changes and differences within Google Jules AI coding tasks to review modifications and understand development progress.

Instructions

Analyze code changes and diff in a Jules task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeSourceCodeNoWhether to include full source code content
taskIdYesTask ID or URL

Implementation Reference

  • The core handler function implementing jules_analyze_code. Navigates to Jules task page, scrapes source files and code diff elements, summarizes changes and returns analysis as text.
    private async analyzeCode(args: any) {
      const { taskId, includeSourceCode = false } = args;
      const actualTaskId = this.extractTaskId(taskId);
      const page = await this.getPage();
    
      try {
        const url = taskId.includes('jules.google.com') ? taskId : `${this.config.baseUrl}/task/${actualTaskId}`;
        await page.goto(url);
        await page.waitForLoadState('networkidle');
    
        // Extract code analysis information
        const codeData = await page.evaluate((includeSource) => {
          const sourceFiles = Array.from(document.querySelectorAll('div.source-content a')).map(link => ({
            filename: link.textContent?.trim() || '',
            url: link.getAttribute('href') || ''
          }));
    
          const codeChanges = Array.from(document.querySelectorAll('swebot-code-diff-update-card')).map(card => ({
            type: 'code-change',
            content: card.textContent?.trim() || ''
          }));
    
          return {
            sourceFiles,
            codeChanges,
            totalFiles: sourceFiles.length,
            totalChanges: codeChanges.length
          };
        }, includeSourceCode);
    
        const analysis = `Code Analysis for Task ${actualTaskId}:\n\n` +
                       `Total Files: ${codeData.totalFiles}\n` +
                       `Total Changes: ${codeData.totalChanges}\n\n` +
                       `Modified Files:\n${codeData.sourceFiles.map(f => `  - ${f.filename}`).join('\n')}\n\n` +
                       `Code Changes Summary:\n${codeData.codeChanges.map(c => `  - ${c.content.slice(0, 100)}...`).join('\n')}`;
    
        return {
          content: [
            {
              type: 'text',
              text: analysis
            }
          ]
        };
      } catch (error) {
        throw new Error(`Failed to analyze code: ${error}`);
      }
  • Input schema for jules_analyze_code tool defining parameters: taskId (required string), includeSourceCode (optional boolean).
    {
      name: 'jules_analyze_code',
      description: 'Analyze code changes and diff in a Jules task',
      inputSchema: {
        type: 'object',
        properties: {
          taskId: {
            type: 'string',
            description: 'Task ID or URL',
          },
          includeSourceCode: {
            type: 'boolean',
            description: 'Whether to include full source code content',
          },
        },
        required: ['taskId'],
      },
  • src/index.ts:377-378 (registration)
    Dispatch registration in CallToolRequestSchema switch statement mapping 'jules_analyze_code' to analyzeCode handler.
    case 'jules_analyze_code':
      return await this.analyzeCode(args);
  • src/index.ts:118-356 (registration)
    Tool registration in ListToolsRequestSchema response including jules_analyze_code in the tools array.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          // === CORE TASK MANAGEMENT ===
          {
            name: 'jules_create_task',
            description: 'Create a new task in Google Jules with repository and description',
            inputSchema: {
              type: 'object',
              properties: {
                description: {
                  type: 'string',
                  description: 'Task description - what you want Jules to do',
                },
                repository: {
                  type: 'string',
                  description: 'GitHub repository in format owner/repo-name',
                },
                branch: {
                  type: 'string',
                  description: 'Git branch to work on (optional, defaults to main)',
                },
              },
              required: ['description', 'repository'],
            },
          },
          {
            name: 'jules_get_task',
            description: 'Get details of a specific Jules task by ID or URL',
            inputSchema: {
              type: 'object',
              properties: {
                taskId: {
                  type: 'string',
                  description: 'Task ID or full Jules task URL',
                },
              },
              required: ['taskId'],
            },
          },
          {
            name: 'jules_list_tasks',
            description: 'List all Jules tasks with their status',
            inputSchema: {
              type: 'object',
              properties: {
                status: {
                  type: 'string',
                  enum: ['all', 'active', 'pending', 'completed', 'paused'],
                  description: 'Filter tasks by status',
                },
                limit: {
                  type: 'number',
                  description: 'Maximum number of tasks to return (default 10)',
                },
              },
            },
          },
          {
            name: 'jules_send_message',
            description: 'Send a message/instruction to Jules in an active task',
            inputSchema: {
              type: 'object',
              properties: {
                taskId: {
                  type: 'string',
                  description: 'Task ID or URL',
                },
                message: {
                  type: 'string',
                  description: 'Message to send to Jules',
                },
              },
              required: ['taskId', 'message'],
            },
          },
          {
            name: 'jules_approve_plan',
            description: 'Approve Jules execution plan for a task',
            inputSchema: {
              type: 'object',
              properties: {
                taskId: {
                  type: 'string',
                  description: 'Task ID or URL',
                },
              },
              required: ['taskId'],
            },
          },
          {
            name: 'jules_resume_task',
            description: 'Resume a paused Jules task',
            inputSchema: {
              type: 'object',
              properties: {
                taskId: {
                  type: 'string',
                  description: 'Task ID or URL',
                },
              },
              required: ['taskId'],
            },
          },
          // === ADVANCED TASK OPERATIONS ===
          {
            name: 'jules_analyze_code',
            description: 'Analyze code changes and diff in a Jules task',
            inputSchema: {
              type: 'object',
              properties: {
                taskId: {
                  type: 'string',
                  description: 'Task ID or URL',
                },
                includeSourceCode: {
                  type: 'boolean',
                  description: 'Whether to include full source code content',
                },
              },
              required: ['taskId'],
            },
          },
          {
            name: 'jules_bulk_create_tasks',
            description: 'Create multiple tasks from a list of descriptions and repositories',
            inputSchema: {
              type: 'object',
              properties: {
                tasks: {
                  type: 'array',
                  items: {
                    type: 'object',
                    properties: {
                      description: { type: 'string' },
                      repository: { type: 'string' },
                      branch: { type: 'string' },
                    },
                    required: ['description', 'repository'],
                  },
                  description: 'Array of task objects to create',
                },
              },
              required: ['tasks'],
            },
          },
          // === SESSION & AUTHENTICATION MANAGEMENT ===
          {
            name: 'jules_session_info',
            description: 'Get current session configuration and authentication status',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
          {
            name: 'jules_setup_wizard',
            description: 'Interactive session setup wizard for automated Google authentication configuration',
            inputSchema: {
              type: 'object',
              properties: {
                environment: {
                  type: 'string',
                  enum: ['local', 'cloud', 'smithery', 'auto-detect'],
                  description: 'Deployment environment (auto-detect will analyze current setup)',
                },
                preferences: {
                  type: 'object',
                  properties: {
                    priority: {
                      type: 'string',
                      enum: ['ease-of-use', 'reliability', 'portability', 'performance'],
                      description: 'User priority for session management'
                    },
                    hasChrome: {
                      type: 'boolean',
                      description: 'Whether user has local Chrome browser access'
                    },
                    cloudDeployment: {
                      type: 'boolean', 
                      description: 'Whether deploying to cloud platforms'
                    }
                  }
                }
              },
            },
          },
          {
            name: 'jules_get_cookies',
            description: 'Extract current browser cookies for session persistence and backup',
            inputSchema: {
              type: 'object',
              properties: {
                format: {
                  type: 'string',
                  enum: ['json', 'string'],
                  description: 'Output format for cookies (default: json)',
                },
              },
            },
          },
          {
            name: 'jules_set_cookies',
            description: 'Set browser cookies from string or JSON for authentication',
            inputSchema: {
              type: 'object',
              properties: {
                cookies: {
                  type: 'string',
                  description: 'Cookies as JSON string or cookie string format',
                },
                format: {
                  type: 'string',
                  enum: ['json', 'string'],
                  description: 'Format of input cookies (default: json)',
                },
              },
              required: ['cookies'],
            },
          },
          // === DEBUGGING & UTILITIES ===
          {
            name: 'jules_screenshot',
            description: 'Take a screenshot of current Jules page for debugging and verification',
            inputSchema: {
              type: 'object',
              properties: {
                taskId: {
                  type: 'string',
                  description: 'Optional task ID to navigate to first',
                },
                filename: {
                  type: 'string',
                  description: 'Optional filename for screenshot',
                },
              },
            },
          },
        ],

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/mberjans/google-jules-mcp'

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