Skip to main content
Glama

get_current_web_app_url

Retrieve the connection URL and QR code for the AFK Mode web app to access remote task monitoring and decision prompts from mobile devices.

Instructions

Returns the connection URL and QR code for the AFK Mode web app. Call this when the user asks for the AFK app link or QR code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'get_current_web_app_url' tool. It retrieves the current session, gets the web app URL via the getWebAppUrl callback, generates a QR code markdown, and returns a JSON response containing the URL, QR code markdown, and session ID.
    async () => {
      const session = getSession();
      const url = getWebAppUrl();
      const qrCodeMarkdown = await generateQrMarkdown(url);
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(
              {
                url,
                qrCodeMarkdown,
                sessionId: session.sessionId,
              },
              null,
              2,
            ),
          },
        ],
      };
    },
  • Registration of the 'get_current_web_app_url' tool using server.tool(). Defines the tool name, description, empty input schema ({}), and the async handler function.
    server.tool(
      "get_current_web_app_url",
      "Returns the connection URL and QR code for the AFK Mode web app. Call this when the user asks for the AFK app link or QR code.",
      {},
      async () => {
        const session = getSession();
        const url = getWebAppUrl();
        const qrCodeMarkdown = await generateQrMarkdown(url);
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(
                {
                  url,
                  qrCodeMarkdown,
                  sessionId: session.sessionId,
                },
                null,
                2,
              ),
            },
          ],
        };
      },
    );
  • Input schema for the tool - an empty object {} indicating no input parameters are required.
    {},
  • Helper function generateQrMarkdown that creates a QR code data URI from a URL and returns it as markdown image syntax. Used by the get_current_web_app_url handler.
    export async function generateQrMarkdown(url: string): Promise<string> {
      const dataUri = await QRCode.toDataURL(url, {
        width: 256,
        margin: 2,
        errorCorrectionLevel: "M",
      });
      return `![AFK Mode QR Code](${dataUri})`;
    }
  • Definition of the getWebAppUrl callback function that constructs the web app URL using local IP, port, and session token. Passed to registerTools and used by the tool handler.
    const localIp = getLocalIp();
    const getWebAppUrl = () => `http://${localIp}:${port}/?token=${session.sessionToken}`;
    
    // ── MCP Server (stdio) ──
    const mcpServer = new McpServer({
      name: "afk-mode-mcp",
      version: "1.0.0",
    });
    
    registerTools(mcpServer, getWebAppUrl);
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes the return content (URL and QR code) but lacks details on format (e.g., image vs. text), potential errors, or authentication needs. It's adequate but not rich in behavioral context.

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

Conciseness5/5

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

It's front-loaded with the core purpose in the first sentence and usage guidance in the second, with zero wasted words. Every sentence adds clear value without redundancy.

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?

For a simple, parameterless tool with no output schema, the description covers purpose and usage well. However, without annotations or output schema, it could benefit from more detail on return format or error handling, slightly limiting completeness.

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, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a baseline score of 4 for this context.

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 clearly states the tool's purpose with specific verbs ('returns') and resources ('connection URL and QR code for the AFK Mode web app'), and distinguishes it from siblings by focusing on app access rather than status, decisions, or notifications.

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?

It provides explicit guidance on when to use this tool ('when the user asks for the AFK app link or QR code'), which clearly differentiates it from sibling tools like get_afk_status (status checks) or get_user_decision (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