manage_session
Approve coding plans or send feedback for Jules autonomous coding tasks to maintain human oversight during development workflows.
Instructions
Manage an active Jules session: approve plans or send feedback
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session ID | |
| action | Yes | Action to perform | |
| message | No | Message (required for send_message) |
Implementation Reference
- src/mcp/tools.ts:207-236 (handler)The main handler function for the manage_session tool in JulesTools class. Handles 'approve_plan' by calling client.approvePlan and 'send_message' by calling client.sendMessage.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'); }); }
- src/mcp/tools.ts:55-69 (schema)Zod schema defining input for manage_session tool: session_id, action (approve_plan or send_message), 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:226-245 (registration)Tool registration in ListToolsRequestSchema handler, defining name, description, and inputSchema for manage_session.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'], }, },
- src/index.ts:322-326 (registration)Dispatcher case in CallToolRequestSchema handler that validates args with ManageSessionSchema and calls this.tools.manageSession.case 'manage_session': { const validated = ManageSessionSchema.parse(args); result = await this.tools.manageSession(validated); break; }