From an LLM response to a checked CSV.
Repair syntax, validate a known contract, export only if validation passes. Three real MCP calls with separate request IDs.
1. Allow this workflow
Create a limited tools:invoke key allowing json-repair, json-schema and json-csv, with a quota of at least 3 calls per minute. One key is enough for repeat runs within its scope, quota and expiry.
Initial setup uses wallet sign-in and a profile. Free calls need no USDC or payment signature. Store the key as INVOKEPORT_API_KEY in your client's private environment, never in a prompt or public file.
2. Run the reproducible example
The example uses synthetic data. Download the script into an empty local folder and install its pinned MCP SDK dependency. The script itself calls no model.
Download agent-workflow.mjsnpm install @modelcontextprotocol/sdk@1.30.0
node agent-workflow.mjs
# After privately configuring INVOKEPORT_API_KEY:
node agent-workflow.mjs --runThe first command after installation only discovers tools. --run performs exactly three free calls, stopping on errors. Each started attempt ID is printed before its request so an uncertain outcome can be checked without re-execution.
3. Inspect the result
"name","count" "Alpha","2" "Beta","3"
Check the three completed request IDs in your agent diagnostics. A handshake or page view is not a successful invocation.
Repair is best effort; review its meaning. Schema validation supports a bounded structural subset. CSV accepts flat rows. If any result is missing, rejected or omitted, export stops. No automatic retries or payments.
Use this in your own agent
Connect https://invokeport.com/api/mcp, then let your agent select the typed tools for your task. You can reuse the orchestration function in the downloaded file; adapt the schema to your own contract. Check scope and quota before a recurring run.