get_afk_status
Check AFK mode status to determine whether to route interactions through mobile notifications or use native chat, ensuring proper handling when away from desk.
Instructions
Returns the current AFK mode status. Call this before every interaction to decide whether to route through AFK MCP tools or native chat. If afkMode is true and clientConnected is true, route through notify_session_progress / get_user_decision. If afkMode is true but clientConnected is false, fall back to native chat and warn the user. If afkMode is false, use native VS Code chat as usual.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server/mcp-tools.ts:49-63 (handler)The handler function for 'get_afk_status' tool. Retrieves the current session using getSession() and returns a JSON response containing afkMode, clientConnected, and sessionId properties.
async () => { const session = getSession(); return { content: [ { type: "text" as const, text: JSON.stringify({ afkMode: session.afkMode, clientConnected: session.clientConnected, sessionId: session.sessionId, }), }, ], }; }, - src/server/session.ts:10-20 (schema)The Session interface defines the data structure for session state, including sessionId (string), afkMode (boolean), and clientConnected (boolean) properties that are returned by the get_afk_status tool.
export interface Session { sessionId: string; sessionToken: string; afkMode: boolean; clientConnected: boolean; progressHistory: ProgressHistoryEntry[]; pendingDecisions: Map<string, PendingDecision>; pushSubscription: PushSubscriptionData | null; reconnectTicket: string | null; reconnectTicketExpiry: number | null; } - src/server/mcp-tools.ts:44-64 (registration)Registration of the 'get_afk_status' tool with the MCP server using server.tool(). Includes tool name, description, empty input schema ({}), and the async handler function.
// ── get_afk_status ── server.tool( "get_afk_status", "Returns the current AFK mode status. Call this before every interaction to decide whether to route through AFK MCP tools or native chat. If afkMode is true and clientConnected is true, route through notify_session_progress / get_user_decision. If afkMode is true but clientConnected is false, fall back to native chat and warn the user. If afkMode is false, use native VS Code chat as usual.", {}, async () => { const session = getSession(); return { content: [ { type: "text" as const, text: JSON.stringify({ afkMode: session.afkMode, clientConnected: session.clientConnected, sessionId: session.sessionId, }), }, ], }; }, ); - src/server/session.ts:39-44 (helper)The getSession() helper function retrieves the current session object. It throws an error if the session hasn't been initialized via initSession().
export function getSession(): Session { if (!session) { throw new Error("Session not initialized. Call initSession() first."); } return session; }