Skip to main content
Glama
PiQrypt

PiQrypt MCP Server

piqrypt_verify_chain

Verify an agent's decision history for integrity, detecting tampering, missing events, chain breaks, or forks. Ensures the audit trail is untampered before trusting historical agent outputs.

Instructions

Verify that an agent's decision history is intact and untampered. Detects modified events, missing events, hash chain breaks, and forks. Call before trusting any historical agent output.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventsYesArray of PiQrypt events to verify

Implementation Reference

  • The verify_chain() function is the actual handler that receives events from the TypeScript layer, looks up the agent identity, calls aiss.verify_chain(), and returns the validation result (valid, events_count, errors, vigil_url).
    def verify_chain(params: Dict[str, Any]) -> Dict[str, Any]:
        """
        Verify integrity of event chain.
    
        Args:
            params: dict with events list, optional agent_name
    
        Returns:
            dict with valid, events_count, errors, vigil_url
        """
        events     = params.get("events", [])
        agent_name = params.get("agent_name")
        errors     = []
        valid      = False
    
        try:
            if agent_name:
                identity = aiss.load_agent_identity(agent_name)
            elif events:
                agent_id = events[0].get("agent_id", "")
                identity = _find_identity_by_agent_id(agent_id)
                if identity is None:
                    return {
                        "valid": False,
                        "events_count": len(events),
                        "errors": [
                            f"Identity not found locally for agent_id '{agent_id}'. "
                            "Pass agent_name to verify a chain whose identity is stored here."
                        ],
                        "vigil_url": VIGIL_URL,
                    }
            else:
                return {
                    "valid": True,
                    "events_count": 0,
                    "errors": [],
                    "vigil_url": VIGIL_URL,
                }
    
            valid = bool(aiss.verify_chain(events, identity))
    
        except Exception as exc:
            errors.append(str(exc))
    
        return {
            "valid": valid,
            "events_count": len(events),
            "errors": errors,
            "vigil_url": VIGIL_URL,
        }
  • The input schema for piqrypt_verify_chain tool. Defines the 'events' array parameter as required input.
    {
      name: 'piqrypt_verify_chain',
      description: 'Verify that an agent\'s decision history is intact and untampered. Detects modified events, missing events, hash chain breaks, and forks. Call before trusting any historical agent output.',
      inputSchema: {
        type: 'object',
        properties: {
          events: {
            type: 'array',
            description: 'Array of PiQrypt events to verify',
            items: { type: 'object' },
          },
        },
        required: ['events'],
      },
  • src/index.ts:203-207 (registration)
    The tool registration inside the CallToolRequestSchema handler. Maps tool name 'piqrypt_verify_chain' to callPythonBridge('verify', {events: args.events}).
    case 'piqrypt_verify_chain':
      result = callPythonBridge('verify', {
        events: args.events,
      });
      break;
  • src/index.ts:92-92 (registration)
    Tool definition in the tools array, listing name, description, and inputSchema for piqrypt_verify_chain.
    name: 'piqrypt_verify_chain',
  • Core verification logic: resolves identity (via agent_name or agent_id from events), calls aiss.verify_chain(events, identity), and catches exceptions to populate errors list.
    try:
        if agent_name:
            identity = aiss.load_agent_identity(agent_name)
        elif events:
            agent_id = events[0].get("agent_id", "")
            identity = _find_identity_by_agent_id(agent_id)
            if identity is None:
                return {
                    "valid": False,
                    "events_count": len(events),
                    "errors": [
                        f"Identity not found locally for agent_id '{agent_id}'. "
                        "Pass agent_name to verify a chain whose identity is stored here."
                    ],
                    "vigil_url": VIGIL_URL,
                }
        else:
            return {
                "valid": True,
                "events_count": 0,
                "errors": [],
                "vigil_url": VIGIL_URL,
            }
    
        valid = bool(aiss.verify_chain(events, identity))
    
    except Exception as exc:
Behavior3/5

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

With no annotations, the description adequately describes what the tool detects (tampering evidence). However, it lacks details on output/return behavior (e.g., error vs result) and side effects, which would improve transparency.

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, no wasted words, front-loaded with the main action and key details.

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 simple tool with full schema coverage, the description covers purpose and usage. It lacks specification of return value (e.g., boolean, report), but overall is complete enough for an agent to invoke correctly.

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% and the description does not add additional meaning beyond the schema's 'Array of PiQrypt events to verify'. Baseline score of 3 is appropriate as the schema already carries the parameter semantics.

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's purpose: verifying integrity of an agent's decision history. It lists specific detection capabilities (modified events, missing events, etc.) and distinguishes itself from siblings by its verification role.

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 includes explicit usage guidance: 'Call before trusting any historical agent output.' While it doesn't explicitly exclude scenarios or name alternatives, the clear context is sufficient for an agent to decide when to invoke this tool.

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