stop_monitoring
Terminate metacognitive monitoring sessions to retrieve a concise summary of insights and reasoning patterns detected by the MCP Dual-Cycle Reasoner.
Instructions
Stop metacognitive monitoring and get session summary
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:290-316 (handler)The execute handler function for the 'stop_monitoring' tool. It retrieves the session engine, logs the stop action, calls stopMonitoring on the engine, and returns a formatted session summary.execute: async (args, { log, session }) => { try { const sessionEngine = this.getSessionEngine(session); const sessionId = this.sessionIds.get(session); const status = sessionEngine.getMonitoringStatus(); log.info('Stopping monitoring', { goal: status.current_goal, interventions: status.intervention_count, traceLength: status.trace_length, sessionId, }); sessionEngine.stopMonitoring(); return ( `🛑 Monitoring stopped. Session summary:\n` + `- Goal: ${status.current_goal}\n` + `- Total interventions: ${status.intervention_count}\n` + `- Trace length: ${status.trace_length} actions` ); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); log.error('Failed to stop monitoring', { error: errorMessage }); throw new UserError(`Failed to stop monitoring: ${errorMessage}`); } },
- src/server.ts:279-317 (registration)The registration of the 'stop_monitoring' tool via this.server.addTool in the addStopMonitoringTool method.this.server.addTool({ name: 'stop_monitoring', description: 'Stop metacognitive monitoring and get session summary', parameters: z.object({}), annotations: { title: 'Stop Metacognitive Monitoring', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, execute: async (args, { log, session }) => { try { const sessionEngine = this.getSessionEngine(session); const sessionId = this.sessionIds.get(session); const status = sessionEngine.getMonitoringStatus(); log.info('Stopping monitoring', { goal: status.current_goal, interventions: status.intervention_count, traceLength: status.trace_length, sessionId, }); sessionEngine.stopMonitoring(); return ( `🛑 Monitoring stopped. Session summary:\n` + `- Goal: ${status.current_goal}\n` + `- Total interventions: ${status.intervention_count}\n` + `- Trace length: ${status.trace_length} actions` ); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); log.error('Failed to stop monitoring', { error: errorMessage }); throw new UserError(`Failed to stop monitoring: ${errorMessage}`); } }, });
- src/server.ts:280-289 (schema)Schema definition for the stop_monitoring tool: empty parameters (no input required), with annotations specifying tool properties.name: 'stop_monitoring', description: 'Stop metacognitive monitoring and get session summary', parameters: z.object({}), annotations: { title: 'Stop Metacognitive Monitoring', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false, },
- src/dual-cycle-engine.ts:75-79 (helper)The supporting stopMonitoring method in DualCycleEngine class, called by the tool handler to set isMonitoring to false and log the stop event.stopMonitoring(): void { this.isMonitoring = false; console.log(chalk.blue('🧠 Dual-Cycle Engine: Monitoring stopped')); console.log(chalk.gray(`Total interventions: ${this.interventionCount}`)); }
- src/server.ts:225-225 (registration)The call to addStopMonitoringTool() in setupTools() method, which triggers the tool registration.this.addStopMonitoringTool();