Approvals during a call
Ask the player at the risky moment, with the real numbers.
When the real cost is only known during the call, ask then, with the numbers:
Framework is Dalamud's IFramework service, and PlanPurchase your own code.
var basket = await Framework.RunOnFrameworkThread(PlanPurchase);
var question = $"Buy {basket.Summary} for {basket.Gil:N0} gil";
if (!await call.RequestApprovalAsync(McpCapabilities.SpendGil, question))
throw new McpToolException(
"The player declined the purchase; nothing was bought.");How it answers
trueright away if the player allows the capability, or set this one tool to Allow.falseright away if the capability is denied.- Otherwise it shows an approval window and waits: two minutes, then
false.
Rules
- For a capability set to Ask, the player is asked twice: once before the call, and once more here. They are not asked the second time if they chose Approve for this session or Always allow the first time. So only ask here when your question adds something, like the price.
- A "no" is final for this call. Throw, and say what was not done. If the assistant calls again, the player is asked again, and can set the capability to Deny to stop that.
- Only declared capabilities. Asking for a capability the tool did not declare returns
falseand is flagged. - Only in long-running tools. Quick tools run on the framework thread and must not wait.
Use mcp.CheckPermission(capability) beforehand to adapt, for example to skip an optional purchase when spending is denied.