Skip to main content

invoke

Function invoke 

Source
pub fn invoke(name: &str, args: &Value) -> Result<Value, String>
Expand description

Invoke a platform tool declared in this skill’s [[permissions]].

The call runs through the platform’s governed dispatch — the user’s tools grant (cmd: skill grant <skill> tools), the capability gate under the calling user, and the policy engine — so it can be refused even when declared. On refusal the runtime attaches the full remedy to this tool call’s result for the agent; the Err here is a short category for the guest’s own control flow. Rate-limited calls (429) are retried host-side with backoff before the envelope comes back.

Ok is the platform envelope: {"success": bool, "output": …, "error": …} — check success, a tool-level failure is data, not a policy denial.

let result = tools::invoke("slack.post_message", &json!({
    "channel": "C123", "text": "done"
}))?;