#[non_exhaustive]pub struct NewSessionRequest {
pub cwd: PathBuf,
pub additional_directories: Vec<PathBuf>,
pub mcp_servers: Vec<McpServer>,
pub system_prompt: Option<SystemPrompt>,
pub config_options: Vec<InitialSessionConfigOption>,
pub meta: Option<Map<String, Value>>,
}Expand description
Request parameters for creating a new session.
See protocol docs: Creating a Session
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.cwd: PathBufThe working directory for this session. Must be an absolute path.
additional_directories: Vec<PathBuf>Additional workspace roots for this session. Each path must be absolute.
These expand the session’s filesystem scope without changing cwd, which
remains the base for relative paths. When omitted or empty, no
additional roots are activated for the new session.
mcp_servers: Vec<McpServer>List of MCP (Model Context Protocol) servers the agent should connect to.
system_prompt: Option<SystemPrompt>System-level instructions for the new session.
Optional. Omitted and null are equivalent and mean the Agent uses its
own default instructions. Clients MUST only send this when the Agent
advertises sessionCapabilities.systemPrompt.
config_options: Vec<InitialSessionConfigOption>unstable_session_options only.UNSTABLE
This capability is not part of the spec yet, and may be removed or changed at any point.
Initial values for the session’s config options.
Optional. Omitted and null are equivalent to an empty list. Clients MUST only send
this when the Agent advertises sessionCapabilities.options.
The Agent applies the entries in list order, as if the Client had called
session/set_config_option for each entry after the session was set up. Malformed
entries and duplicate configId values fail the request with -32602. The Agent MUST
ignore an entry whose configId is unknown, whose type does not match the option,
or whose value is not allowed when it is applied. The configOptions in the response contain the values the session actually
has. The Agent SHOULD NOT send config_option_update notifications for these entries,
and SHOULD NOT send other session/update notifications caused by applying them
before it responds.
meta: Option<Map<String, Value>>The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Implementations§
Source§impl NewSessionRequest
impl NewSessionRequest
Sourcepub fn new(cwd: impl Into<PathBuf>) -> NewSessionRequest
pub fn new(cwd: impl Into<PathBuf>) -> NewSessionRequest
Builds NewSessionRequest with the required request fields set. Optional fields start unset or empty.
Sourcepub fn additional_directories(
self,
additional_directories: Vec<PathBuf>,
) -> NewSessionRequest
pub fn additional_directories( self, additional_directories: Vec<PathBuf>, ) -> NewSessionRequest
Additional workspace roots for this session. Each path must be absolute.
Sourcepub fn mcp_servers(self, mcp_servers: Vec<McpServer>) -> NewSessionRequest
pub fn mcp_servers(self, mcp_servers: Vec<McpServer>) -> NewSessionRequest
List of MCP (Model Context Protocol) servers the agent should connect to.
Sourcepub fn system_prompt(
self,
system_prompt: impl IntoOption<SystemPrompt>,
) -> NewSessionRequest
pub fn system_prompt( self, system_prompt: impl IntoOption<SystemPrompt>, ) -> NewSessionRequest
System-level instructions for the new session.
Sourcepub fn config_options(
self,
config_options: Vec<InitialSessionConfigOption>,
) -> NewSessionRequest
Available on crate feature unstable_session_options only.
pub fn config_options( self, config_options: Vec<InitialSessionConfigOption>, ) -> NewSessionRequest
unstable_session_options only.UNSTABLE
This capability is not part of the spec yet, and may be removed or changed at any point.
Initial values for the session’s config options.
Optional. Omitted and null are equivalent to an empty list. Clients MUST only send
this when the Agent advertises sessionCapabilities.options.
The Agent applies the entries in list order, as if the Client had called
session/set_config_option for each entry after the session was set up. Malformed
entries and duplicate configId values fail the request with -32602. The Agent MUST
ignore an entry whose configId is unknown, whose type does not match the option,
or whose value is not allowed when it is applied. The configOptions in the response contain the values the session actually
has. The Agent SHOULD NOT send config_option_update notifications for these entries,
and SHOULD NOT send other session/update notifications caused by applying them
before it responds.
Sourcepub fn meta(
self,
meta: impl IntoOption<Map<String, Value>>,
) -> NewSessionRequest
pub fn meta( self, meta: impl IntoOption<Map<String, Value>>, ) -> NewSessionRequest
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Trait Implementations§
Source§impl Clone for NewSessionRequest
impl Clone for NewSessionRequest
Source§fn clone(&self) -> NewSessionRequest
fn clone(&self) -> NewSessionRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NewSessionRequest
impl Debug for NewSessionRequest
Source§impl<'de> Deserialize<'de> for NewSessionRequest
impl<'de> Deserialize<'de> for NewSessionRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NewSessionRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NewSessionRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for NewSessionRequest
Source§impl JsonRpcMessage for NewSessionRequest
impl JsonRpcMessage for NewSessionRequest
Source§fn matches_method(method: &str) -> bool
fn matches_method(method: &str) -> bool
Source§fn to_untyped_message(&self) -> Result<UntypedMessage, Error>
fn to_untyped_message(&self) -> Result<UntypedMessage, Error>
Source§impl JsonRpcRequest for NewSessionRequest
impl JsonRpcRequest for NewSessionRequest
Source§type Response = NewSessionResponse
type Response = NewSessionResponse
Source§impl JsonSchema for NewSessionRequest
impl JsonSchema for NewSessionRequest
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for NewSessionRequest
impl PartialEq for NewSessionRequest
Source§impl Serialize for NewSessionRequest
impl Serialize for NewSessionRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for NewSessionRequest
Auto Trait Implementations§
impl Forget for NewSessionRequest
impl Freeze for NewSessionRequest
impl Move for NewSessionRequest
impl RefUnwindSafe for NewSessionRequest
impl Send for NewSessionRequest
impl Sync for NewSessionRequest
impl Unpin for NewSessionRequest
impl UnsafeUnpin for NewSessionRequest
impl UnwindSafe for NewSessionRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.