Skip to main content
Glama

query_actions

Check previously recorded agent actions from the audit trail. Filter by agent ID or action type to verify history or recall past decisions.

Instructions

Look up previously recorded actions from the audit trail. Use this to check what actions have been taken, verify history, or recall past decisions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idNoFilter by agent ID
action_typeNoFilter by action type
limitNoMax entries to return (default 20)

Implementation Reference

  • Handler for the query_actions tool: takes filter params (agent_id, action_type, limit), calls GET /v1/entries API, and formats results into a text summary.
    if (name === "query_actions") {
      const params = new URLSearchParams();
      if (args.agent_id) params.set("agent_id", args.agent_id);
      if (args.action_type) params.set("action_type", args.action_type);
      params.set("limit", String(args.limit || 20));
    
      const entries = await apiCall("GET", `/v1/entries?${params}`);
    
      if (entries.length === 0) {
        return {
          content: [{ type: "text", text: "No actions found matching the query." }],
        };
      }
    
      const summary = entries
        .map(
          (e) =>
            `[${e.timestamp}] ${e.agent_id} — ${e.action_type}: ${JSON.stringify(e.action_params)}` +
            (e.reasoning ? `\n  Reasoning: ${e.reasoning}` : "")
        )
        .join("\n\n");
    
      return {
        content: [{ type: "text", text: `Found ${entries.length} entries:\n\n${summary}` }],
      };
    }
  • Schema definition for query_actions tool: optional filters for agent_id, action_type, and limit. Registered with the ListToolsRequestSchema handler.
    {
      name: "query_actions",
      description:
        "Look up previously recorded actions from the audit trail. " +
        "Use this to check what actions have been taken, verify history, " +
        "or recall past decisions.",
      inputSchema: {
        type: "object",
        properties: {
          agent_id: {
            type: "string",
            description: "Filter by agent ID",
          },
          action_type: {
            type: "string",
            description: "Filter by action type",
          },
          limit: {
            type: "number",
            description: "Max entries to return (default 20)",
          },
        },
      },
  • index.js:42-119 (registration)
    Tool registration via ListToolsRequestSchema handler — query_actions is listed as one of three available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: "record_action",
          description:
            "Record an agent action to the AgentSeal audit hash trail. " +
            "Call this after every significant action (sending emails, modifying files, " +
            "running queries, making API calls) to create a cryptographically sealed record " +
            "of what happened and why.",
          inputSchema: {
            type: "object",
            properties: {
              agent_id: {
                type: "string",
                description: "Identifier for this agent (e.g. 'research-bot', 'finance-agent')",
              },
              action_type: {
                type: "string",
                description:
                  "What type of action was taken (e.g. 'email:send', 'file:write', 'api:call', 'db:query')",
              },
              action_params: {
                type: "object",
                description: "Parameters of the action (e.g. {to: 'user@example.com', subject: '...'})",
              },
              reasoning: {
                type: "string",
                description: "Why you decided to take this action — your chain of thought",
              },
              authorized_by: {
                type: "string",
                description: "Who or what authorized this action (e.g. 'user:alice', 'policy:auto-approve')",
              },
            },
            required: ["agent_id", "action_type"],
          },
        },
        {
          name: "query_actions",
          description:
            "Look up previously recorded actions from the audit trail. " +
            "Use this to check what actions have been taken, verify history, " +
            "or recall past decisions.",
          inputSchema: {
            type: "object",
            properties: {
              agent_id: {
                type: "string",
                description: "Filter by agent ID",
              },
              action_type: {
                type: "string",
                description: "Filter by action type",
              },
              limit: {
                type: "number",
                description: "Max entries to return (default 20)",
              },
            },
          },
        },
        {
          name: "verify_chain",
          description:
            "Verify the integrity of the audit trail hash chain. " +
            "Each entry's SHA-256 hash includes the previous entry's hash — " +
            "if any record was modified, the chain breaks and this will report where.",
          inputSchema: {
            type: "object",
            properties: {
              agent_id: {
                type: "string",
                description: "Verify chain for a specific agent only. If omitted, verifies all entries.",
              },
            },
          },
        },
      ],
  • Helper function apiCall used by the query_actions handler to make the GET /v1/entries request to the AgentSeal API.
    async function apiCall(method, path, body = null) {
      const opts = {
        method,
        headers: {
          Authorization: `Bearer ${API_KEY}`,
          "Content-Type": "application/json",
        },
      };
      if (body) opts.body = JSON.stringify(body);
    
      const res = await fetch(`${BASE_URL}${path}`, opts);
      if (!res.ok) {
        const text = await res.text();
        throw new Error(`AgentSeal API error ${res.status}: ${text}`);
      }
      return res.json();
    }
Behavior3/5

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

No annotations provided, so the description carries the burden. It implies read-only behavior by saying 'look up', but does not explicitly state non-destructiveness, side effects, or permissions needed. It is adequate but could be more explicit.

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?

Two succinct sentences, front-loaded with the main purpose, no redundant information. Every sentence adds value.

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 simplicity (3 optional parameters, no output schema), the description covers the main use. However, it omits details about the return format, which could aid agent understanding. Still, it is mostly complete.

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

Parameters3/5

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

Schema coverage is 100%, so baseline is 3. The description does not add any extra meaning beyond what the schema already provides for each parameter. It is sufficient but not enhanced.

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 'look up' and the resource 'previously recorded actions from the audit trail'. It also lists use cases: 'check what actions have been taken, verify history, or recall past decisions'. This distinguishes it from siblings like record_action (write) and verify_chain.

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

Usage Guidelines4/5

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

The description provides clear context on when to use the tool (check actions, verify history, recall decisions). However, it does not explicitly mention when not to use it or compare to alternatives, though siblings are distinct enough.

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/JoeyBrar/agentseal-mcp'

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