Skip to main content
Glama
attestedintelligence

AGA-mcp-server

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),
    );

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