Skip to main content
Glama
PiQrypt

PiQrypt MCP Server

piqrypt_export_audit

Export a complete agent audit trail to a portable JSON archive. Optionally request a PiQrypt CA signature for legal admissibility (eIDAS Art.26), creating a self-contained export verifiable without PiQrypt.

Instructions

Export the complete agent audit trail to a portable JSON archive. Set certified=true to request a PiQrypt CA signature for legal admissibility (eIDAS Art.26). The export is self-contained and verifiable without PiQrypt installed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesAgent ID to export
certifiedNoCreate certified export (requires Pro license)
output_formatNoOutput format (json or encrypted pqz archive)json

Implementation Reference

  • The Python bridge handler for 'export_audit' called by the MCP server when the 'piqrypt_export_audit' tool is invoked. Loads the agent identity and events from AISS, exports the audit chain to a JSON file, and returns status/path/events_count.
    def export_audit(params: Dict[str, Any]) -> Dict[str, Any]:
        """
        Export agent audit trail.
    
        Args:
            params: dict with agent_name (or agent_id), optional certified,
                    output_path
    
        Returns:
            dict with status, path, certified, vigil_url
        """
        agent_name = params.get("agent_name", params.get("agent_id", "default"))
        certified  = params.get("certified", False)
        output     = params.get("output_path",
                                str(pathlib.Path.home() / ".piqrypt"
                                    / f"audit_{agent_name}.json"))
    
        identity = aiss.load_agent_identity(agent_name)
        events   = aiss.load_events(agent_name=agent_name)
        audit    = aiss.export_audit_chain(identity, events)
    
        output_path = pathlib.Path(output)
        output_path.parent.mkdir(parents=True, exist_ok=True)
        with open(output_path, "w") as f:
            json.dump(audit, f, indent=2)
    
        return {
            "status": "success",
            "path": str(output_path),
            "events_count": len(events),
            "certified": certified,
            "vigil_url": VIGIL_URL,
        }
  • The TypeScript MCP server handler that dispatches the 'piqrypt_export_audit' tool call to the Python bridge with the 'export' command, passing agent_id, certified, and output_format parameters.
    case 'piqrypt_export_audit':
      result = callPythonBridge('export', {
        agent_id: args.agent_id,
        certified: args.certified || false,
        output_format: args.output_format || 'json',
      });
      break;
  • src/index.ts:106-130 (registration)
    The tool registration in the tools array, defining the 'piqrypt_export_audit' tool with its description, inputSchema (agent_id required, certified boolean, output_format enum), and metadata.
    {
      name: 'piqrypt_export_audit',
      description: 'Export the complete agent audit trail to a portable JSON archive. Set certified=true to request a PiQrypt CA signature for legal admissibility (eIDAS Art.26). The export is self-contained and verifiable without PiQrypt installed.',
      inputSchema: {
        type: 'object',
        properties: {
          agent_id: {
            type: 'string',
            description: 'Agent ID to export',
          },
          certified: {
            type: 'boolean',
            description: 'Create certified export (requires Pro license)',
            default: false,
          },
          output_format: {
            type: 'string',
            enum: ['json', 'pqz'],
            description: 'Output format (json or encrypted pqz archive)',
            default: 'json',
          },
        },
        required: ['agent_id'],
      },
    },
  • The CLI command dispatch that routes the 'export' command string to the export_audit() Python function.
    elif command == "export":
        result = export_audit(params)
    else:
        raise PiQryptBridgeError(f"Unknown command: {command}")
  • The callPythonBridge helper function that spawns the Python bridge subprocess with the given command and params, returning the parsed JSON result.
    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}`);
Behavior3/5

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

Discloses that export is self-contained and verifiable, and mentions Pro license requirement. Does not detail side effects or reading behavior; with no annotations, this is moderate.

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 sentences, each adding essential information: purpose and certification detail. No unnecessary words.

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?

Lacks output schema but describes the result as a portable JSON archive. Missing details on error conditions or what the audit trail contains, but adequate for a simple export.

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?

Schema coverage is 100%, so baseline is 3. Description adds value for the certified parameter (legal admissibility) and clarifies the export scope (complete trail).

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 exports a complete agent audit trail to JSON, using a specific verb and resource. It distinguishes well from sibling tools like piqrypt_search_events.

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?

Provides context on when to use certified=true and notes the export is self-contained. Lacks explicit when-not-to-use or alternatives, but siblings are distinct actions.

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