Skip to content

Commit 2c79061

Browse files
chazcbclaude
andcommitted
Add RFD: Session Input Options Discovery
Proposal for allowing Agents to declare what input options they accept for session/new and session/load requests in InitializeResponse. This complements the existing Session Config Options RFD: - Input Options: Discovery of options for session creation/loading - Config Options: Runtime configuration during a session Key features: - JSON Schema subset for rich type definitions - Separate schemas for newSession vs loadSession - Enables dynamic client UIs for session configuration - All options are optional - Agents must provide defaults Co-Authored-By: Claude <[email protected]>
1 parent 7303c99 commit 2c79061

1 file changed

Lines changed: 289 additions & 0 deletions

File tree

Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
---
2+
title: "Session Input Options Discovery"
3+
---
4+
5+
Author(s): [@chazcb](https://github.com/chazcb)
6+
7+
## Elevator pitch
8+
9+
> What are you proposing to change?
10+
11+
Allow Agents to declare what input options they accept for `session/new` and `session/load` requests in the `InitializeResponse`. This enables Clients to build dynamic configuration UIs *before* creating a session, showing users exactly what options are available and their types.
12+
13+
This proposal complements the existing [Session Config Options RFD](./session-config-options) which handles *runtime* configuration (mode/model selectors during a session). This RFD addresses *input* discovery - what options can be passed when creating or loading sessions.
14+
15+
## Status quo
16+
17+
> How do things work today and what problems does this cause? Why would we change things?
18+
19+
Currently, the ACP schema defines some standard fields on `NewSessionRequest` and `LoadSessionRequest`:
20+
21+
- `cwd` - Working directory for the session
22+
- `mcpServers` - List of MCP servers to connect
23+
24+
However:
25+
26+
1. **Not all Agents support all options** - Some agents don't use `cwd` or have their own working directory handling. Some agents don't support client-provided MCP servers. Clients have no way to know which standard options an agent actually accepts.
27+
28+
2. **Agent-specific options are invisible** - Agents may want to accept additional options (like initial model, system prompt, subagents, etc.), but there's no standard way to expose these to clients.
29+
30+
3. **New vs Load may differ** - Creating a new session might accept different options than loading an existing one (e.g., you might set certain options only at creation time).
31+
32+
4. **Client UIs are static** - Without discovery, clients must either hardcode known options or provide generic key-value inputs, neither of which provides a good user experience.
33+
34+
## What we propose to do about it
35+
36+
> What are you proposing to improve the situation?
37+
38+
Add an `inputOptions` field to `InitializeResponse` that declares what options an Agent accepts for session creation and loading. Use a JSON Schema subset for type definitions to enable rich client UIs.
39+
40+
```json
41+
{
42+
"jsonrpc": "2.0",
43+
"id": 1,
44+
"result": {
45+
"protocolVersion": 1,
46+
"agentCapabilities": { ... },
47+
"agentInfo": { ... },
48+
"inputOptions": {
49+
"newSession": {
50+
"model": {
51+
"enum": ["claude-sonnet-4-20250514", "claude-opus-4-20250514", "claude-haiku"],
52+
"description": "Model to use for this session"
53+
},
54+
"systemPrompt": {
55+
"type": "string",
56+
"description": "Custom system prompt to guide the agent's behavior"
57+
},
58+
"enabledSubagents": {
59+
"type": "array",
60+
"items": { "type": "string" },
61+
"description": "List of subagent IDs to enable for this session"
62+
},
63+
"maxTokens": {
64+
"type": "integer",
65+
"description": "Maximum tokens per response"
66+
}
67+
},
68+
"loadSession": {
69+
"model": {
70+
"enum": ["claude-sonnet-4-20250514", "claude-opus-4-20250514", "claude-haiku"],
71+
"description": "Model to use when resuming (can differ from original)"
72+
}
73+
}
74+
}
75+
}
76+
}
77+
```
78+
79+
Clients pass input options via `inputOptions` on `NewSessionRequest` and `LoadSessionRequest`:
80+
81+
```json
82+
{
83+
"jsonrpc": "2.0",
84+
"id": 2,
85+
"method": "session/new",
86+
"params": {
87+
"cwd": "/path/to/project",
88+
"mcpServers": [],
89+
"inputOptions": {
90+
"model": "claude-sonnet-4-20250514",
91+
"systemPrompt": "You are a helpful coding assistant.",
92+
"enabledSubagents": ["web-search", "code-execution"],
93+
"maxTokens": 4096
94+
}
95+
}
96+
}
97+
```
98+
99+
## Shiny future
100+
101+
> How will things will play out once this feature exists?
102+
103+
**For Clients:**
104+
- Query `inputOptions` from `InitializeResponse` to know what the Agent accepts
105+
- Build dynamic forms showing available options with proper input types (text fields, dropdowns for enums, checkboxes for booleans)
106+
- Show different options for "New Session" vs "Load Session" flows
107+
- Gracefully handle Agents that don't declare any `inputOptions`
108+
109+
**For Agents:**
110+
- Declare supported options with types and descriptions
111+
- MUST handle all options as optional - clients may not provide all (or any) options
112+
- MUST provide sensible defaults for undeclared options
113+
- Can declare standard ACP options (`cwd`, `mcpServers`) in `inputOptions` to indicate explicit support
114+
115+
**Key behaviors:**
116+
- Input options are for session *creation/loading*, not runtime configuration
117+
- Runtime configuration (mode switching, model selection during a session) is handled by the [Session Config Options RFD](./session-config-options)
118+
- Agents can support both: `inputOptions` for initial setup, `configOptions` for runtime changes
119+
120+
## Implementation details and plan
121+
122+
> Tell me more about your implementation. What is your detailed implementation plan?
123+
124+
### Schema
125+
126+
The `inputOptions` schema uses a simplified JSON Schema subset to balance expressiveness with cross-language compatibility:
127+
128+
```typescript
129+
type InputOptionSchema =
130+
| { type: "string"; description?: string }
131+
| { type: "number"; description?: string }
132+
| { type: "integer"; description?: string }
133+
| { type: "boolean"; description?: string }
134+
| { enum: (string | number | boolean | null)[]; description?: string }
135+
| { type: "array"; items: InputOptionSchema; description?: string }
136+
| { type: "object"; properties: Record<string, InputOptionSchema>; required?: string[]; description?: string };
137+
138+
interface InitializeResponse {
139+
protocolVersion: number;
140+
agentCapabilities: AgentCapabilities;
141+
agentInfo: AgentInfo;
142+
inputOptions?: {
143+
newSession?: Record<string, InputOptionSchema>;
144+
loadSession?: Record<string, InputOptionSchema>;
145+
};
146+
}
147+
148+
interface NewSessionRequest {
149+
cwd: string;
150+
mcpServers: McpServer[];
151+
inputOptions?: Record<string, unknown>;
152+
}
153+
154+
interface LoadSessionRequest {
155+
sessionId: string;
156+
cwd: string;
157+
mcpServers: McpServer[];
158+
inputOptions?: Record<string, unknown>;
159+
}
160+
```
161+
162+
### Why JSON Schema subset instead of `select`/`text` types?
163+
164+
The existing [Session Config Options RFD](./session-config-options) uses `select` and `text` types because runtime selectors are primarily UI widgets - dropdowns and text fields.
165+
166+
Input options need richer types because they're data inputs:
167+
- **Booleans** - checkboxes, toggle switches
168+
- **Numbers/Integers** - numeric inputs with validation
169+
- **Enums** - constrained choice from known values
170+
- **Arrays** - multi-select or list inputs
171+
- **Objects** - nested configuration groups
172+
173+
### Passing input options
174+
175+
Clients send input options in `inputOptions` on session requests:
176+
177+
```json
178+
{
179+
"method": "session/new",
180+
"params": {
181+
"cwd": "/path/to/project",
182+
"mcpServers": [],
183+
"inputOptions": {
184+
"mode": "code",
185+
"maxResults": 50,
186+
"enableFeature": true
187+
}
188+
}
189+
}
190+
```
191+
192+
Values should match the declared types (strings, numbers, booleans - not string-encoded).
193+
194+
### Relationship to well-known protocol fields
195+
196+
The ACP protocol already defines some fields on `NewSessionRequest` and `LoadSessionRequest`:
197+
198+
- `cwd` - Working directory (required, top-level)
199+
- `mcpServers` - MCP server configurations (required, top-level)
200+
201+
These **remain top-level fields** on the request - they are not moved into `inputOptions`. The `inputOptions` field is for **additional agent-specific options** beyond what the protocol defines.
202+
203+
```json
204+
{
205+
"method": "session/new",
206+
"params": {
207+
"cwd": "/path/to/project",
208+
"mcpServers": [...],
209+
"inputOptions": {
210+
"model": "claude-sonnet-4-20250514",
211+
"systemPrompt": "You are a helpful assistant."
212+
}
213+
}
214+
}
215+
```
216+
217+
This keeps a clean separation:
218+
- **Protocol fields** - Always present, well-defined schemas, top-level
219+
- **Agent-specific options** - Discovered via `inputOptions` schema, passed in `inputOptions` object
220+
221+
### Implementation phases
222+
223+
**Phase 1: Schema definition**
224+
- Add `InputOptionSchema` type definitions to ACP schema
225+
- Add `inputOptions` to `InitializeResponse`
226+
- Add `inputOptions` to `NewSessionRequest` and `LoadSessionRequest`
227+
228+
**Phase 2: Client support**
229+
- Update TypeScript SDK to expose `inputOptions`
230+
- Implement example UI rendering in reference client
231+
232+
**Phase 3: Agent adoption**
233+
- Document pattern for agents to declare their options
234+
- Add examples to protocol documentation
235+
236+
## Frequently asked questions
237+
238+
> What questions have arisen over the course of authoring this document or during subsequent discussions?
239+
240+
### What alternative approaches did you consider, and why did you settle on this one?
241+
242+
1. **Extend Session Config Options with richer types** - The existing [Session Config Options RFD](./session-config-options) uses `select`/`text` types. We could update that RFD to support richer types (boolean, number, array, nested objects) and use the same schema for both input options and runtime config options. This would provide consistency across the protocol. The main tradeoff is that runtime selectors (mode/model dropdowns) have different UX needs than input options (forms with various field types), but a unified schema could still work well for both.
243+
244+
2. **Separate discovery endpoint** - Could add a `session/describe` method. Rejected because `InitializeResponse` already exists for capability discovery and adding another round-trip adds latency.
245+
246+
3. **Use full JSON Schema** - Could support the complete JSON Schema spec. Rejected for cross-language compatibility - a simplified subset is easier to implement consistently across TypeScript, Python, Kotlin, etc.
247+
248+
### How does this relate to Session Config Options?
249+
250+
| Aspect | Input Options (this RFD) | Config Options (existing RFD) |
251+
|--------|-------------------------|-------------------------------|
252+
| When | Before session creation | During session runtime |
253+
| Purpose | Set initial configuration | Change configuration mid-session |
254+
| Examples | Initial model, system prompt, subagents | Switch modes, change model mid-session |
255+
| Schema | JSON Schema subset | `select`/`text` types |
256+
| Location | `InitializeResponse.inputOptions` | `NewSessionResponse.configOptions` |
257+
258+
Agents can support both - use `inputOptions` for things that can only be set at creation time, and `configOptions` for things that can be changed during the session.
259+
260+
### Should we unify the schema with Session Config Options?
261+
262+
This is an open question worth discussing. The Session Config Options RFD currently uses `select`/`text` types, while this proposal uses a JSON Schema subset. We could:
263+
264+
**Option A: Keep them separate** (current proposal)
265+
- Input options use JSON Schema subset (richer types for form inputs)
266+
- Config options use `select`/`text` (simpler for runtime selectors)
267+
- Pro: Each is optimized for its use case
268+
- Con: Two different schema systems to learn and implement
269+
270+
**Option B: Unify on JSON Schema subset**
271+
- Update Session Config Options RFD to use the same JSON Schema subset
272+
- Both input options and config options use identical schema definitions
273+
- Pro: Consistency, single schema system
274+
- Con: May be overkill for simple runtime selectors
275+
276+
**Option C: Unify on extended select/text**
277+
- Extend the `select`/`text` types to support boolean, number, array, etc.
278+
- Pro: Builds on existing work
279+
- Con: Inventing a new schema language vs using JSON Schema conventions
280+
281+
Feedback welcome on which approach the community prefers.
282+
283+
### Are input options required?
284+
285+
No. Agents MUST handle missing options gracefully. Clients MAY not support input options UI. This is purely for discoverability and better UX.
286+
287+
## Revision history
288+
289+
- 2025-01-22: Initial draft

0 commit comments

Comments
 (0)