Skip to main content
Glama

lu_verify_message

Validate message sequences in AI agent sessions by checking protocol compliance and identifying expected next steps.

Instructions

Verify whether a message is valid in the context of an ongoing session.

Replays the existing message history against the protocol, then checks
whether next_message is the expected next step.

Args:
    protocol_text: Full .lu protocol definition text.
    messages: List of already-sent messages, each a dict with keys:
        sender (str), receiver (str), action (str).
        Actions are LU action names: "asks", "returns", "sends",
        "proposes", "tells". These match the verbs in .lu source files.
    next_message: The message to validate, same format as above.

Returns:
    JSON string:
      On success: {"valid": true, "step": N, "next_expected": "..."}
      On violation: {"valid": false, "violation": "...", "expected": "...", "got": "..."}
      On error: {"valid": false, "error": "..."}

Example:
    protocol_text = "protocol Ping:\n    roles: a, b\n    a asks b to ping\n    b returns pong to a\n    properties:\n        always terminates\n"
    messages = [{"sender": "a", "receiver": "b", "action": "ask"}]
    next_message = {"sender": "b", "receiver": "a", "action": "return"}
    # Returns: {"valid": true, ...}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protocol_textYes
messagesYes
next_messageYes

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/rafapra3008/cervellaswarm'

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