Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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,
            }),
          },
        ],
      };
    },
  • 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;
    }
  • 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,
              }),
            },
          ],
        };
      },
    );
  • 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;
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior by explaining the return values (afkMode and clientConnected status) and their implications for routing decisions. However, it lacks details on error handling, response format, or any rate limits, leaving some behavioral aspects unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded, starting with the core purpose. Each sentence adds value by explaining usage scenarios and routing logic. However, it could be slightly more concise by combining some conditional statements, though all content is relevant and earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple status check with 0 parameters) and lack of annotations/output schema, the description is largely complete. It covers purpose, usage, and behavioral implications. However, it does not specify the exact return format (e.g., JSON structure) or error cases, which could enhance completeness for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, with 100% schema description coverage. The description does not need to add parameter semantics, so a baseline of 4 is appropriate. It appropriately focuses on the tool's purpose and usage without unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the tool's purpose: 'Returns the current AFK mode status.' It uses a specific verb ('Returns') and resource ('AFK mode status'), clearly distinguishing it from sibling tools like 'get_user_decision' or 'notify_session_progress' which perform different actions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'Call this before every interaction to decide whether to route through AFK MCP tools or native chat.' It also details specific conditions (e.g., 'If afkMode is true and clientConnected is true...') and mentions alternatives like 'native chat' and sibling tools, offering clear context for decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/paulbennet/afk-mode-mcp'

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