Skip to main content
Glama

aga_get_chain

Retrieve continuity chain events with optional verification and filtering for tamper-evident logging in AI agent interactions.

Instructions

Get continuity chain events with optional verification and filtering. (Claim 3c)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_seqNo
end_seqNo
verifyNo
filter_typeNoFilter: all, behavioral, delegations, receipts, revocations, attestations, disclosure, keys

Implementation Reference

  • The implementation of the 'aga_get_chain' tool, responsible for retrieving and optionally verifying chain events.
    export async function handleGetChain(args: GetChainArgs, ctx: ServerContext) {
      let events = (args.start_seq !== undefined && args.end_seq !== undefined)
        ? await ctx.storage.getEvents(args.start_seq, args.end_seq)
        : await ctx.storage.getAllEvents();
    
      // Apply filter_type
      if (args.filter_type && args.filter_type !== 'all') {
        const allowedTypes = FILTER_MAP[args.filter_type];
        if (allowedTypes) {
          events = events.filter(e => allowedTypes.includes(e.event_type));
        }
      }
    
      const result: Record<string, unknown> = {
        count: events.length,
        events: events.map(e => ({
          sequence_number: e.sequence_number,
          event_type: e.event_type,
          event_id: e.event_id,
          timestamp: e.timestamp,
          leaf_hash: e.leaf_hash.slice(0, 16) + '...',
          previous_leaf_hash: e.previous_leaf_hash ? e.previous_leaf_hash.slice(0, 16) + '...' : null,
          payload_hash: e.payload_hash.slice(0, 16) + '...',
        })),
      };
    
      if (args.verify) {
        const allEvents = await ctx.storage.getAllEvents();
        const integrity = verifyChainIntegrity(allEvents);
        result.chain_valid = integrity.valid;
        result.broken_at = integrity.brokenAt;
        result.verification_error = integrity.error;
        result.leaf_hash_formula = 'SHA-256(schema_version || protocol_version || event_type || event_id || sequence_number || timestamp || previous_leaf_hash) - PAYLOAD EXCLUDED';
        result.event_signature_covers = 'COMPLETE event including payload';
      }
    
      return ctx.json(result);
    }
  • Input arguments schema for the 'aga_get_chain' tool.
    export interface GetChainArgs {
      start_seq?: number;
      end_seq?: number;
      verify?: boolean;
      filter_type?: string;
    }
  • src/server.ts:237-246 (registration)
    Tool registration for 'aga_get_chain' in the server setup.
    server.tool('aga_get_chain',
      'Get continuity chain events with optional verification and filtering. (Claim 3c)',
      {
        start_seq: z.number().optional(),
        end_seq: z.number().optional(),
        verify: z.boolean().optional(),
        filter_type: z.string().optional().describe('Filter: all, behavioral, delegations, receipts, revocations, attestations, disclosure, keys'),
      },
      async (args) => handleGetChain(args, ctx),
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'optional verification and filtering' which hints at some behavior, but fails to disclose critical aspects: what 'continuity chain events' are, whether this is a read-only operation, potential side effects, authentication requirements, rate limits, or error conditions. For a tool with 4 parameters and no annotation coverage, this is inadequate.

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 brief and front-loaded with the core purpose. The single sentence is efficient, though the unexplained '(Claim 3c)' adds unnecessary clutter. Overall, it avoids verbosity while still conveying basic intent.

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

Completeness2/5

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

Given the tool's complexity (4 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain what 'continuity chain events' are, what verification entails, how filtering works, what the return format looks like, or any error handling. For a tool that appears to query a specialized system with multiple configuration options, much more context is needed.

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 description coverage is only 25% (only filter_type has a description). The description mentions 'optional verification and filtering' which loosely maps to the 'verify' and 'filter_type' parameters, adding minimal context beyond the schema. However, it doesn't explain what 'start_seq' and 'end_seq' represent (sequence numbers? timestamps?), leaving half the parameters semantically unclear. This meets the baseline for partial compensation.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('continuity chain events'), making the purpose understandable. However, it doesn't explicitly differentiate this tool from its many siblings (like aga_get_portal_state or aga_verify_artifact), which would require a 5. The parenthetical '(Claim 3c)' is unexplained and adds no clarity.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. With 20 sibling tools including other 'get' operations (aga_get_portal_state) and verification tools (aga_verify_artifact, aga_verify_bundle), the description offers no context about appropriate use cases, prerequisites, or exclusions.

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/attestedintelligence/aga-mcp-server'

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