Check tool-call / tool-result pairing and ordering in an LLM transcript (Anthropic, OpenAI Chat, OpenAI Responses)

$0.005 USDC per call · Agent infrastructure · POST /api/v1/transcript-validator · Id transcript-validator

Validates a message list before it is sent to Anthropic Messages, OpenAI Chat Completions or OpenAI Responses: every tool call paired with its result, results in the right place and role, ids present and unique. Built for an agent that edits, truncates or replays its own history and would otherwise get a 400. Only rules stated in the providers' documentation fail the check; anything else suspicious (for example an unanswered Chat Completions tool call, whose requirement the docs do not state) returns unknown with the reason. Does not validate message content, tool schemas, role alternation or thinking/reasoning blocks, and does not call any provider.

What you get

Finds the orphaned tool_use or dropped function_call_output before the provider rejects the request.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/transcript-validator. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/transcript-validator \
  -H 'content-type: application/json' \
  -d '{"provider":"anthropic","messages":[{"role":"user","content":"Weather in Paris?"},{"role":"assistant","content":[{"type":"tool_use","id":"toolu_1","name":"get_weather","input":{"city":"Paris"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_1","content":"18C"},{"type":"text","text":"Thanks"}]}]}'

Input

FieldTypeRequiredDescription
providerstring; one of "anthropic", "openai-chat", "openai-responses"yes
messagesarray<any>; max 500 itemsyes
expectCompletebooleannoDefault true: a trailing tool call without a result is a defect. Set false when the transcript is mid-loop and results are still pending.

Example request body

{
  "provider": "anthropic",
  "messages": [
    {
      "role": "user",
      "content": "Weather in Paris?"
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "tool_use",
          "id": "toolu_1",
          "name": "get_weather",
          "input": {
            "city": "Paris"
          }
        }
      ]
    },
    {
      "role": "user",
      "content": [
        {
          "type": "tool_result",
          "tool_use_id": "toolu_1",
          "content": "18C"
        },
        {
          "type": "text",
          "text": "Thanks"
        }
      ]
    }
  ]
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass.
pairsarray<object>no
pendingIdsarray<string>noTool call ids without a result.
ruleBasisstringnoDocumentation the rules come from.
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways true: pure code, no model.

Pay and connect

Available through: x402 (USDC on Base), MCP. MCP clients reach it through the execution-safety-kit package.

Machine-readable