Skip to content

Commit c3d4139

Browse files
committed
Improve docs
1 parent 2aaee43 commit c3d4139

7 files changed

Lines changed: 32 additions & 33 deletions

File tree

docs/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"protocol/terminals",
6060
"protocol/agent-plan",
6161
"protocol/session-modes",
62-
"protocol/commands",
62+
"protocol/slash-commands",
6363
"protocol/extensibility",
6464
"protocol/schema"
6565
]

docs/protocol/overview.mdx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ Agents are programs that use generative AI to autonomously modify code. They typ
8484
`loadSession` capability).
8585
</ResponseField>
8686

87+
<ResponseField
88+
name="session/set_mode"
89+
post={[<a href="./schema#session%2Fset-mode">Schema</a>]}
90+
>
91+
[Switch between agent operating
92+
modes](./session-modes#setting-the-current-mode).
93+
</ResponseField>
94+
8795
### Notifications
8896

8997
<ResponseField
@@ -167,8 +175,12 @@ Clients provide the interface between users and agents. They are typically code
167175
name="session/update"
168176
post={[<a href="./schema#session%2Fupdate">Schema</a>]}
169177
>
170-
[Send progress updates](./prompt-turn#3-agent-reports-output) during prompt
171-
processing (no response expected).
178+
[Send session updates](./prompt-turn#3-agent-reports-output) to inform the
179+
Client of changes (no response expected). This includes: - [Message
180+
chunks](./content) (agent, user, thought) - [Tool calls and
181+
updates](./tool-calls) - [Plans](./agent-plan) - [Available commands
182+
updates](./slash-commands#advertising-commands) - [Mode
183+
changes](./session-modes#from-the-agent)
172184
</ResponseField>
173185

174186
## Argument requirements

docs/protocol/schema.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ All text that was typed after the command name is provided as input.
11081108
<Expandable title="Properties">
11091109

11101110
<ResponseField name="hint" type={"string"} required>
1111-
A brief description of the expected input
1111+
A hint to display when the input hasn't been provided yet
11121112
</ResponseField>
11131113

11141114
</Expandable>
Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: "Commands"
2+
title: "Slash Commands"
33
description: "Advertise available slash commands to clients"
44
---
55

6-
Agents can advertise a set of slash commands that users can invoke. These commands provide quick access to specific agent capabilities and workflows.
6+
Agents can advertise a set of slash commands that users can invoke. These commands provide quick access to specific agent capabilities and workflows. Commands are run as part of regular [prompt](./prompt-turn) requests where the Client includes the command text in the prompt.
77

88
## Advertising commands
99

@@ -65,31 +65,16 @@ After creating a session, the Agent **MAY** send a list of available commands vi
6565
Currently supports unstructured text input:
6666

6767
<ResponseField name="hint" type="string" required>
68-
A brief description of the expected input
68+
A hint to display when the input hasn't been provided yet
6969
</ResponseField>
7070

71-
## Command lifecycle
72-
73-
1. **Discovery**: The Agent sends available commands after session creation
74-
2. **Display**: The Client displays these commands in its UI (e.g., in a slash command menu)
75-
3. **Invocation**: When the user selects a command, the Client includes it in the prompt
76-
4. **Execution**: The Agent processes the command as part of the prompt
77-
78-
Commands are not a separate protocol mechanism - they are simply a way for the Agent to advertise what slash commands it understands. The actual command invocation happens through the regular prompt mechanism.
79-
8071
## Dynamic updates
8172

82-
The Agent can update the list of available commands at any time during a session by sending another `available_commands_update` notification. This allows commands to be:
73+
The Agent can update the list of available commands at any time during a session by sending another `available_commands_update` notification. This allows commands to be added based on context, removed when no longer relevant, or modified with updated descriptions.
8374

84-
- Added based on context (e.g., project type detection)
85-
- Removed when no longer relevant
86-
- Modified with updated descriptions or input hints
75+
## Running commands
8776

88-
Clients may also add their own local commands (e.g., authentication commands) to the list before displaying them to users.
89-
90-
## Example usage
91-
92-
When a user types `/web climate change` in the Client, it would send:
77+
Commands are included as regular user messages in prompt requests:
9378

9479
```json
9580
{
@@ -98,12 +83,14 @@ When a user types `/web climate change` in the Client, it would send:
9883
"method": "session/prompt",
9984
"params": {
10085
"sessionId": "sess_abc123def456",
101-
"prompt": {
102-
"type": "text",
103-
"text": "/web climate change"
104-
}
86+
"prompt": [
87+
{
88+
"type": "text",
89+
"text": "/web agent client protocol"
90+
}
91+
]
10592
}
10693
}
10794
```
10895

109-
The Agent recognizes the command prefix and processes it accordingly, potentially using web search tools to gather information about climate change.
96+
The Agent recognizes the command prefix and processes it accordingly. Commands may be accompanied by any other user message content types (images, audio, etc.) in the same prompt array.

rust/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub enum AvailableCommandInput {
247247
/// All text that was typed after the command name is provided as input.
248248
#[schemars(rename = "UnstructuredCommandInput")]
249249
Unstructured {
250-
/// A brief description of the expected input
250+
/// A hint to display when the input hasn't been provided yet
251251
hint: String,
252252
},
253253
}

schema/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
"description": "All text that was typed after the command name is provided as input.",
255255
"properties": {
256256
"hint": {
257-
"description": "A brief description of the expected input",
257+
"description": "A hint to display when the input hasn't been provided yet",
258258
"type": "string"
259259
}
260260
},

typescript/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ export interface AvailableCommand {
15981598
*/
15991599
export interface UnstructuredCommandInput {
16001600
/**
1601-
* A brief description of the expected input
1601+
* A hint to display when the input hasn't been provided yet
16021602
*/
16031603
hint: string;
16041604
}

0 commit comments

Comments
 (0)