Skip to main content
Glama
PiQrypt

PiQrypt MCP Server

piqrypt_stamp_event

Create a tamper-proof cryptographic audit trail for AI agent decisions. Signs each event with Ed25519 and links it in a hash chain for compliance with GDPR, EU AI Act, HIPAA, and financial regulations.

Instructions

Create a tamper-proof cryptographic record of an agent decision. Signs the event with Ed25519, links it to the previous event in a hash chain (AISS v2.0). Call this after every significant agent action. Required for GDPR Art.22, EU AI Act Art.13, HIPAA audit trail, SEC/FINRA trading compliance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesAgent identifier (e.g., "trading_bot_v1", "hr_decision_engine")
payloadYesEvent payload containing decision data (JSON object)
previous_hashNoOptional hash of previous event for chain integrity

Implementation Reference

  • Core handler - Python function that creates the cryptographic stamp via aiss.stamp_event(), storing the signed event and returning it with chain metadata.
    def stamp_event(params: Dict[str, Any]) -> Dict[str, Any]:
        """
        Stamp an event with a real AISS v2.0 signature.
    
        Args:
            params: dict with agent_name (or agent_id), payload,
                    optional previous_hash, identity_file
    
        Returns:
            dict with event, chain_length, vigil_url, hint
        """
        agent_name  = params.get("agent_name", params.get("agent_id", "default"))
        payload     = params.get("payload", {})
        prev_hash   = params.get("previous_hash")
    
        private_key, agent_id = _get_or_create_identity(agent_name)
    
        event = aiss.stamp_event(private_key, agent_id, payload,
                                 previous_hash=prev_hash)
        aiss.store_event(event, agent_name=agent_name)
    
        try:
            events = aiss.load_events(agent_name=agent_name)
            chain_length = len(events)
        except Exception:
            chain_length = 1
    
        return {
            "event": event,
            "chain_length": chain_length,
            "vigil_url": VIGIL_URL,
            "hint": VIGIL_HINT,
        }
  • MCP call handler - dispatches 'piqrypt_stamp_event' to callPythonBridge('stamp', ...) which invokes the Python bridge with agent_id, payload, and previous_hash.
    case 'piqrypt_stamp_event':
      result = callPythonBridge('stamp', {
        agent_id: args.agent_id,
        payload: args.payload,
        previous_hash: args.previous_hash,
      });
      break;
  • src/index.ts:69-90 (registration)
    Tool registration - defines tool name 'piqrypt_stamp_event', description, and inputSchema specifying agent_id, payload (object), and optional previous_hash.
    {
      name: 'piqrypt_stamp_event',
      description: 'Create a tamper-proof cryptographic record of an agent decision. Signs the event with Ed25519, links it to the previous event in a hash chain (AISS v2.0). Call this after every significant agent action. Required for GDPR Art.22, EU AI Act Art.13, HIPAA audit trail, SEC/FINRA trading compliance.',
      inputSchema: {
        type: 'object',
        properties: {
          agent_id: {
            type: 'string',
            description: 'Agent identifier (e.g., "trading_bot_v1", "hr_decision_engine")',
          },
          payload: {
            type: 'object',
            description: 'Event payload containing decision data (JSON object)',
          },
          previous_hash: {
            type: 'string',
            description: 'Optional hash of previous event for chain integrity',
          },
        },
        required: ['agent_id', 'payload'],
      },
    },
  • Helper function - callPythonBridge() spawns the Python bridge as a subprocess and parses JSON stdout, used by all tool handlers including piqrypt_stamp_event.
    function callPythonBridge(command: string, params: any): any {
      const pythonCmd = process.env.PIQRYPT_PYTHON
        || (process.platform === 'win32' ? 'python' : 'python3');
    
      const result = spawnSync(
        pythonCmd,
        [PYTHON_BRIDGE, command, JSON.stringify(params)],
        { encoding: 'utf-8', timeout: 30000 }
      );
    
      if (result.error) throw new Error(`PiQrypt bridge spawn error: ${result.error.message}`);
      if (result.status !== 0) throw new Error(`PiQrypt bridge error: ${result.stderr}`);
    
      const stdout = result.stdout;
      const jsonStart = stdout.indexOf('{');
      if (jsonStart === -1) throw new Error(`No JSON in bridge output: ${stdout}`);
      return JSON.parse(stdout.slice(jsonStart));
    }
  • Input schema for piqrypt_stamp_event - defines agent_id (string), payload (object), previous_hash (string, optional). Required: agent_id and payload.
    inputSchema: {
      type: 'object',
      properties: {
        agent_id: {
          type: 'string',
          description: 'Agent identifier (e.g., "trading_bot_v1", "hr_decision_engine")',
        },
        payload: {
          type: 'object',
          description: 'Event payload containing decision data (JSON object)',
        },
        previous_hash: {
          type: 'string',
          description: 'Optional hash of previous event for chain integrity',
        },
      },
      required: ['agent_id', 'payload'],
    },
Behavior4/5

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

Without annotations, the description discloses key behaviors: tamper-proof record creation, Ed25519 signing, and hash chain linking. It lacks details on side effects, idempotency, or error handling, but covers essential traits.

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 concise at two sentences, front-loading the purpose and including key details. It is efficient but could be slightly more structured by grouping regulations separately.

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 tool with 3 parameters and no output schema, the description covers purpose, usage, and behavioral details adequately. The lack of return value description is a minor shortfall, but overall it is fairly 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?

The input schema already describes all three parameters with 100% coverage. The description adds no additional semantics beyond the schema, so a baseline score of 3 is appropriate.

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 creates a cryptographic record, specifying the signing algorithm (Ed25519) and chaining mechanism (AISS v2.0), which distinguishes it from sibling tools for export, search, and verification.

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 explicitly advises 'Call this after every significant agent action' and lists regulatory requirements, providing strong contextual cues. However, it does not explicitly exclude cases where the tool should not be called.

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/PiQrypt/piqrypt-mcp-server'

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