Skip to main content
Glama

manage_session

Approve coding plans or send feedback for active Jules coding sessions to control autonomous development tasks.

Instructions

Manage an active Jules session: approve plans or send feedback

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYesSession ID
actionYesAction to perform
messageNoMessage (required for send_message)

Implementation Reference

  • The `manageSession` method in the `JulesTools` class that implements the core execution logic for the `manage_session` tool. It handles `approve_plan` by calling `client.approvePlan` and `send_message` by calling `client.sendMessage`, with consistent error handling.
     * Tool: manage_session
     * Manages session lifecycle (approve plan, send feedback).
     * @param args - The arguments for managing a session.
     * @returns A JSON string representing the result of the action.
     */
    async manageSession(
      args: z.infer<typeof ManageSessionSchema>
    ): Promise<string> {
      return this.executeWithErrorHandling(async () => {
        if (args.action === 'approve_plan') {
          const session = await this.client.approvePlan(args.session_id);
          return {
            message: 'Plan approved. Session is now executing.',
            newState: session.state,
          };
        }
    
        if (args.action === 'send_message') {
          if (!args.message) {
            throw new Error('Message is required for send_message action');
          }
    
          const session = await this.client.sendMessage(args.session_id, {
            prompt: args.message,
          });
    
          return {
            message: 'Feedback sent to session',
            newState: session.state,
          };
        }
    
        throw new Error('Invalid action');
      });
    }
  • Zod input validation schema for the `manage_session` tool, defining `session_id`, `action` (enum: approve_plan, send_message), and optional `message`.
    export const ManageSessionSchema = z.object({
      session_id: z
        .string()
        .regex(/^[\w-]+$/, 'Session ID contains invalid characters')
        .describe('The ID of the session to manage'),
      action: z
        .enum(['approve_plan', 'send_message'])
        .describe('Action to perform on the session'),
      message: z
        .string()
        .min(1, 'Message cannot be empty')
        .max(5000, 'Message must not exceed 5,000 characters')
        .optional()
        .describe('Message content (required for send_message action)'),
    });
  • src/index.ts:322-325 (registration)
    Dispatch handler in `CallToolRequestSchema` that validates input with `ManageSessionSchema` and delegates to `this.tools.manageSession`.
    case 'manage_session': {
      const validated = ManageSessionSchema.parse(args);
      result = await this.tools.manageSession(validated);
      break;
  • src/index.ts:226-245 (registration)
    Tool registration in `ListToolsRequestSchema` response, providing name, description, and input schema mirroring the Zod schema.
      name: 'manage_session',
      description:
        'Manage an active Jules session: approve plans or send feedback',
      inputSchema: {
        type: 'object',
        properties: {
          session_id: { type: 'string', description: 'Session ID' },
          action: {
            type: 'string',
            enum: ['approve_plan', 'send_message'],
            description: 'Action to perform',
          },
          message: {
            type: 'string',
            description: 'Message (required for send_message)',
          },
        },
        required: ['session_id', 'action'],
      },
    },

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/savethepolarbears/jules-mcp-server'

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