Confirm

confirm() maps to MRTR and execute runs after accept.

The examples/confirm app deletes rows only after MRTR acceptance.

tool.ts

export default defineTool({
  description: "Delete rows matching a query",
  input: z.object({ query: z.string() }),
  async confirm({ query }) {
    const plan = planDelete(query);
    return {
      message: `Delete ${plan.rows} rows matching ${query}?`,
      preview: plan,
    };
  },
  async execute({ query }) {
    const plan = planDelete(query);
    return result(plan, `Deleted ${plan.rows} rows.`);
  },
});

What this proves

  • confirm returns MRTR before execute runs
  • Text-only hosts can still confirm via message
  • UI hosts may render preview
  • The mutation does not replay on retry after accept

Run it:

cd examples/confirm
pnpm dev

Try the tool in a text-only client to verify MRTR without a View.