session-status
Check active or sleeping session status, view scope restrictions, and monitor time remaining before auto-sleep in the SecureCode MCP server.
Instructions
Check the current session status: active or sleeping, scope restrictions, and time remaining before auto-sleep.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:670-700 (handler)Implementation of the "session-status" tool, which queries the securecode client for session status and formats the response for the MCP server.
// Tool: session-status server.tool( 'session-status', 'Check the current session status: active or sleeping, scope restrictions, and time remaining before auto-sleep.', {}, async () => { try { const client = getClient(); const s = await client.getSessionStatus(); const scopeText = s.scope ? s.scope.map(f => Object.entries(f).map(([k, v]) => `${k}:${v}`).join(' AND ')).join(' OR ') : 'All secrets'; const timeText = s.timeRemainingMinutes !== null ? `${s.timeRemainingMinutes} min` : 'N/A'; const lines = [ `Session: ${s.status === 'active' ? 'Active' : 'Sleeping (locked)'}`, `Scope: ${scopeText}`, `Auto-sleep: ${s.autoSleepMinutes} min`, ]; if (s.status === 'active') { lines.push(`Time remaining: ${timeText}`); } if (s.wakeAt) lines.push(`Last wake: ${new Date(s.wakeAt).toLocaleString()}`); if (s.sleepAt) lines.push(`Last sleep: ${new Date(s.sleepAt).toLocaleString()}`); return wrapResponse([{ type: 'text' as const, text: lines.join('\n') }]); } catch (e) { return errorResult(e); } }, );