Skip to main content

ControlRequestKind

Enum ControlRequestKind 

Source
pub enum ControlRequestKind {
    CanUseTool {
        tool_name: String,
        input: Value,
        permission_suggestions: Vec<Value>,
        blocked_path: Option<String>,
        tool_use_id: String,
        agent_id: Option<String>,
        decision_reason: Option<String>,
        title: Option<String>,
        display_name: Option<String>,
        description: Option<String>,
    },
    McpMessage {
        server_name: String,
        message: Value,
    },
    HookCallback {
        callback_id: String,
        input: Value,
        tool_use_id: Option<String>,
    },
    Unknown {
        subtype: String,
        raw: Value,
    },
}
Expand description

Enumerates the kinds of control requests we handle.

Unknown is the forward-compat catch-all - any subtype the CLI ships that forge-sdk doesn’t yet model lands here with the full payload captured. The dispatcher in client/control_dispatch.rs responds with a control_response error (since we have no handler) and logs a tracing::warn! so callers notice drift.

Variants§

§

CanUseTool

A permission check for a tool call.

Fields

§tool_name: String

Tool name the model wants to invoke.

§input: Value

The JSON input the model generated.

§permission_suggestions: Vec<Value>

Permission-suggestion hints from the binary (may be empty).

§blocked_path: Option<String>

Path blocked by workspace sandboxing, when applicable.

§tool_use_id: String

Identifier of this tool-use (required; string).

§agent_id: Option<String>

Agent identifier when this is a sub-agent request.

§decision_reason: Option<String>

Free-form reason the CLI surfaced for why human review is needed (e.g. "workspace not yet trusted").

§title: Option<String>

Short title the CLI suggests for the prompt (e.g. "Run tests").

§display_name: Option<String>

Display name for the tool call (often a humanised tool name).

§description: Option<String>

Long-form description the CLI surfaces in the prompt body.

§

McpMessage

MCP JSON-RPC message routed in-process. See mcp module for the MCP routing pipeline.

Fields

§server_name: String

Name of the in-process MCP server this message is addressed to (matches mcpServers config key).

§message: Value

The JSON-RPC request body (initialize / tools/list / tools/call / notifications/initialized).

§

HookCallback

Hook callback invocation. callback_id was registered at connect time via the initialize control_request. See Plan 3 hooks section.

Fields

§callback_id: String

Opaque id assigned by forge-sdk at initialize time.

§input: Value

Hook-specific payload; includes hook_event_name to discriminate.

§tool_use_id: Option<String>

Tool-use id when the hook fired in a tool-use context.

§

Unknown

Forward-compat fallback for subtype values forge-sdk doesn’t recognise. The dispatcher responds with an error (since no handler is registered) and logs a warning. This prevents an unknown CLI subtype from panicking the session.

Fields

§subtype: String

The unrecognised subtype value.

§raw: Value

Full request JSON including request body.

Trait Implementations§

Source§

impl Clone for ControlRequestKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ControlRequestKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ControlRequestKind

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ControlRequestKind

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more