You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/protocol/slash-commands.mdx
+13-26Lines changed: 13 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
-
title: "Commands"
2
+
title: "Slash Commands"
3
3
description: "Advertise available slash commands to clients"
4
4
---
5
5
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.
7
7
8
8
## Advertising commands
9
9
@@ -65,31 +65,16 @@ After creating a session, the Agent **MAY** send a list of available commands vi
65
65
Currently supports unstructured text input:
66
66
67
67
<ResponseFieldname="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
69
69
</ResponseField>
70
70
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
-
80
71
## Dynamic updates
81
72
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.
83
74
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
87
76
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:
93
78
94
79
```json
95
80
{
@@ -98,12 +83,14 @@ When a user types `/web climate change` in the Client, it would send:
98
83
"method": "session/prompt",
99
84
"params": {
100
85
"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
+
]
105
92
}
106
93
}
107
94
```
108
95
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.
0 commit comments