Skip to main content
Glama

ad4m_agent_status

Retrieve the local AD4M agent's DID, initialization state, and keystore lock state to verify agent readiness and connectivity.

Instructions

Get the local AD4M agent status: DID, initialization state, keystore lock state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler for 'ad4m_agent_status' tool. Executes a GraphQL query to the local AD4M executor to fetch agent status (isInitialized, isUnlocked, did) and returns the result formatted as MCP text content.
    // 1. ad4m_agent_status
    server.tool("ad4m_agent_status",
      "Get the local AD4M agent status: DID, initialization state, keystore lock state.",
      {},
      async () => {
        const data = await gql("{ agentStatus { isInitialized isUnlocked did } }");
        return ok(data.agentStatus);
      }
    );
  • src/index.ts:271-273 (registration)
    Registration of the 'ad4m_agent_status' tool using McpServer.tool() with a description and empty input schema.
    server.tool("ad4m_agent_status",
      "Get the local AD4M agent status: DID, initialization state, keystore lock state.",
      {},
  • The gql() helper function that performs the actual GraphQL HTTP request to the AD4M executor, including error handling for connection refused and locked agent scenarios.
    async function gql(query: string, variables: Record<string, unknown> = {}): Promise<GqlResult> {
      const resp = await fetch(AD4M_GQL, {
        method:  "POST",
        headers: { "Content-Type": "application/json" },
        body:    JSON.stringify({ query, variables }),
        signal:  AbortSignal.timeout(10_000),
      });
      if (!resp.ok) throw new Error(`AD4M HTTP ${resp.status}: ${await resp.text()}`);
      const json = await resp.json() as { data?: GqlResult; errors?: { message: string }[] };
      if (json.errors?.length) {
        const msg = json.errors[0].message;
        if (msg.includes("ECONNREFUSED") || msg.includes("fetch failed")) {
          throw new Error("AD4M executor not reachable. Start it with: ad4m serve --port 4000");
        }
        if (msg.includes("Unauthorized") || msg.includes("not unlocked")) {
          throw new Error(`Agent is locked. Unlock with:\ncurl -X POST ${AD4M_GQL} -H 'Content-Type: application/json' -d '{"query":"mutation { agentUnlock(passphrase: \\"YOUR_PASSPHRASE\\") { isUnlocked } }"}'`);
        }
        throw new Error(msg);
      }
      return json.data ?? {};
    }
  • The ok() helper function that wraps the result data into MCP's expected { content: [{ type: 'text', text: ... }] } format.
    function ok(data: unknown) {
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • index.js:516-519 (registration)
    Registration of 'ad4m_agent_status' in the compiled JS (ListToolsRequestSchema handler), defining name, description, and empty inputSchema.
      name: "ad4m_agent_status",
      description: "Get the local AD4M agent status: DID, initialization state, keystore lock state.",
      inputSchema: { type: "object", properties: {} },
    },
Behavior3/5

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

With no annotations, the description carries full burden. It states it gets local status but does not disclose idempotency, authentication needs, or error conditions, though the tool is a simple getter.

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?

The description is a single sentence of 15 words, concise and front-loaded with the essential information.

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

Completeness5/5

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

For a simple tool with no parameters and no output schema, the description is complete: it explains the action, resource, and returned fields.

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?

There are no parameters in the input schema, so the description cannot add parameter meaning. Baseline for 0 parameters is 4, and the description adequately states what is retrieved.

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 verb 'Get', the resource 'local AD4M agent status', and lists specific fields (DID, initialization state, keystore lock state), distinguishing it from sibling tools.

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

Usage Guidelines3/5

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

The description implies usage for checking agent status but does not explicitly state when to use it versus alternatives or any exclusions. It provides minimal guidance.

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/thefranceway/mcp-ad4m'

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