# Ask before acting

Let a tool pause to ask the person through a form or a link: what Ferrite's own tools ask, and how to add confirmations to your application's tools.

Elicitation lets a tool stop in the middle of a call and ask the person something. The client shows the question in its own interface, so the answer comes from the person and not from the model. A server can ask with a **form**, whose fields the client renders, or with a **link** the person opens in a browser, which is how a password or a payment stays out of the conversation.

## What Ferrite's tools ask

When your client supports elicitation, tools on `https://mcp.ferrite.cloud/mcp` ask before they do something costly or hard to undo:

| Tool | What you are asked |
| --- | --- |
| `deploy_source` | Approve the quoted cost before the build starts |
| `withdraw`, `delete_repository` | Type the exact application name |
| `delete_secret`, `remove_member`, `revoke_other_tokens`, `remove_dead_letters` | Yes or no |
| `rollback`, `rollback_release`, `scale` to 0 | Yes or no |
| `set_secret` without a value | Open the application's settings in the Dashboard and enter the value there |
| A tool the balance cannot cover | Open the top-up page, then the call continues |

Answering **yes** continues the same call. Declining or closing the question leaves everything as it was, and the tool says so.

### Enter a secret without pasting it into the chat

Ask your agent to set a secret by name and leave the value out: "set `STRIPE_KEY` on my shop app; I will enter it myself". The agent calls `set_secret` with the application and the name. Your client shows a Dashboard link, you enter the value on that page, and the value never appears in the conversation, the tool call or the transcript. Then deploy, because [a running application sees a new value only after a deploy](/developers/secrets-egress/#when-the-application-sees-a-new-value).

## How a question travels

Under protocol revision `2026-07-28` every request stands alone, so a question is a result and the answer is a retry:

1. The client declares what it can show on each request: `"elicitation": {"form": {}, "url": {}}` under `io.modelcontextprotocol/clientCapabilities`.
2. The tool call returns `resultType: "input_required"` with an `inputRequests` map and an opaque `requestState`.
3. The client asks the person and repeats the call with the same arguments, adding `inputResponses` and the unchanged `requestState`.

```json
{
  "resultType": "input_required",
  "inputRequests": {
    "confirm": {
      "method": "elicitation/create",
      "params": {
        "mode": "form",
        "message": "Delete this note?",
        "requestedSchema": {
          "type": "object",
          "properties": { "confirm": { "type": "boolean", "title": "Delete the note" } },
          "required": ["confirm"]
        }
      }
    }
  },
  "requestState": "opaque-state"
}
```

The answer names an action. `accept` carries the form's `content`, `decline` means the person said no, and `cancel` means the question was closed or never shown:

```json
{
  "inputResponses": {
    "confirm": { "action": "accept", "content": { "confirm": true } }
  },
  "requestState": "opaque-state"
}
```

A server never asks in a mode the client did not declare. A tool that cannot proceed without the answer refuses with error `-32021` and names the capability it needs.

## Add a confirmation to your own tool

In an application built with [`agent-ready`](/developers/agent-native-apps/), implement `PageSource::mcp_tool_call_mrtr`. It runs before the ordinary tool handler: return `None` for a tool that needs no question, and the result otherwise.

```rust filename="src/agent.rs"
async fn mcp_tool_call_mrtr(
    &self,
    name: String,
    params: Value,
) -> Option<Result<Value, ElicitationError>> {
    if name != "delete_note" {
        return None;
    }
    Some(self.confirm_delete(&params).await)
}
```

The first call seals what is being confirmed and asks. The retry opens the seal, checks that it has not been used, and acts:

```rust filename="src/agent.rs"
async fn confirm_delete(&self, params: &Value) -> Result<Value, ElicitationError> {
    let args = params.get("arguments").cloned().unwrap_or_else(|| json!({}));
    let now = self.ctx.now_ms();
    if let Some(token) = params.get("requestState").and_then(Value::as_str) {
        let state = elicitation::open_state(
            &self.secret, token, "delete_note", &args, &self.owner, now,
        )?;
        let answer = elicitation::parse_answer(params, "confirm")?;
        if !self.first_use(&state.nonce, state.expires_ms).await {
            return Err(ElicitationError::invalid_params("this confirmation was already used"));
        }
        return match answer {
            ElicitationAnswer::Accept(form) if form.get("confirm") == Some(&json!(true)) => {
                Ok(self.delete_note(&args).await)
            }
            _ => Ok(json!({"content": [{"type": "text", "text": "Nothing was deleted."}]})),
        };
    }
    elicitation::require_mode(params, Mode::Form)?;
    let failed = |_| ElicitationError::invalid_params("the confirmation could not be prepared");
    let ask = elicitation::form_request("Delete this note?", json!({
        "type": "object",
        "properties": {"confirm": {"type": "boolean", "title": "Delete the note"}},
        "required": ["confirm"]
    })).map_err(failed)?;
    let state = SealedState {
        tool: "delete_note".into(),
        args_sha256: elicitation::args_digest(&args),
        principal: self.owner.clone(),
        nonce: crate::crypto::random_token(16)
            .map_err(|_| ElicitationError::invalid_params("no randomness available"))?,
        expires_ms: now + 600_000,
        context: Value::Null,
    };
    let sealed = elicitation::seal_state(&self.secret, &state).map_err(failed)?;
    elicitation::input_required_result(Map::from_iter([("confirm".into(), ask)]), sealed)
        .map_err(failed)
}

/// True exactly once per nonce, on every instance.
async fn first_use(&self, nonce: &str, expires_ms: u64) -> bool {
    let Ok(mut store) = self.ctx.store("data") else { return false };
    let key = format!("confirmed/{nonce}");
    matches!(
        store.put_if_version_expiring(key.as_bytes(), b"1", None, expires_ms).await,
        Ok(outcome) if outcome.is_ok()
    )
}
```

`SealedState` binds the answer to the tool, the exact arguments, the caller and an expiry, so a confirmation for one note cannot delete another. Keep the sealing secret in an [application secret](/developers/secrets-egress/) of at least 32 random bytes, and take `owner` from the authenticated request. The store write makes each confirmation work once even when two instances receive the same retry.

## Design the question

- Name the thing that will change: "Delete 14 attendees from Saturday's dinner?" rather than "Are you sure?".
- For an action that cannot be undone, ask the person to type the name of the thing.
- Keep a form flat. Each field is a string, number, integer, boolean, or a choice from a list, with a title and a default where one is sensible.
- Never ask for a password, key, or card in a form. Send a link to a page of yours, and check there that the person signed in is the person who started the call.
- Ask only for what the model could not supply. A question on every call trains people to accept without reading.
- Decide what an older client gets. A client that cannot show a question can be given a link to the page in your application where a person does the same thing.

With `agent-ready` 1.17 or newer, one call to `confirm` replaces the sealing and store code above; see [Interactive MCP tools](/developers/mcp-interactive-tools/#confirm-once-on-every-instance).

A [task](/developers/mcp-tasks/#supply-requested-input) can also ask while it runs. Use that when the question depends on the work itself, and the pattern on this page when the answer decides whether the work starts.
