Skip to content

Commit f4aef9e

Browse files
committed
Add missing field docs
1 parent 1cec126 commit f4aef9e

5 files changed

Lines changed: 321 additions & 126 deletions

File tree

docs/protocol/schema.mdx

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,13 @@ Only available if the client supports the `fs.readTextFile` capability.
358358
**Properties:**
359359

360360
<ResponseField name="limit" type={"integer | null"} >
361-
Optional maximum number of lines to read.
361+
Maximum number of lines to read.
362362

363363
- Minimum: `0`
364364

365365
</ResponseField>
366366
<ResponseField name="line" type={"integer | null"} >
367-
Optional line number to start reading from (1-based).
367+
Line number to start reading from (1-based).
368368

369369
- Minimum: `0`
370370

@@ -543,33 +543,52 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
543543

544544
#### <span class="font-mono">CreateTerminalRequest</span>
545545

546+
Request to create a new terminal and execute a command.
547+
546548
**Type:** Object
547549

548550
**Properties:**
549551

550552
<ResponseField name="args" type={<><span>"string"</span><span>[]</span></>} >
553+
Array of command arguments.
551554
</ResponseField>
552555
<ResponseField name="command" type={"string"} required>
556+
The command to execute.
553557
</ResponseField>
554558
<ResponseField name="cwd" type={"string | null"} >
559+
Working directory for the command (absolute path).
555560
</ResponseField>
556561
<ResponseField name="env" type={<><span><a href="#envvariable">EnvVariable</a></span><span>[]</span></>} >
562+
Environment variables for the command.
557563
</ResponseField>
558564
<ResponseField name="outputByteLimit" type={"integer | null"} >
565+
Maximum number of output bytes to retain.
566+
567+
When the limit is exceeded, the Client truncates from the beginning of the output
568+
to stay within the limit.
569+
570+
The Client MUST ensure truncation happens at a character boundary to maintain valid
571+
string output, even if this means the retained output is slightly less than the
572+
specified limit.
559573

560574
- Minimum: `0`
561575

562576
</ResponseField>
563577
<ResponseField name="sessionId" type={<a href="#sessionid">SessionId</a>} required>
578+
The session ID for this request.
564579
</ResponseField>
565580

566581
#### <span class="font-mono">CreateTerminalResponse</span>
567582

583+
Response containing the ID of the created terminal.
584+
568585
**Type:** Object
569586

570587
**Properties:**
571588

572-
<ResponseField name="terminalId" type={"string"} required></ResponseField>
589+
<ResponseField name="terminalId" type={"string"} required>
590+
The unique identifier for the created terminal.
591+
</ResponseField>
573592

574593
<a id="terminal-kill"></a>
575594
### <span class="font-mono">terminal/kill</span>
@@ -589,6 +608,8 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
589608

590609
#### <span class="font-mono">KillTerminalCommandRequest</span>
591610

611+
Request to kill a terminal command without releasing the terminal.
612+
592613
**Type:** Object
593614

594615
**Properties:**
@@ -597,8 +618,12 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
597618
name="sessionId"
598619
type={<a href="#sessionid">SessionId</a>}
599620
required
600-
></ResponseField>
601-
<ResponseField name="terminalId" type={"string"} required></ResponseField>
621+
>
622+
The session ID for this request.
623+
</ResponseField>
624+
<ResponseField name="terminalId" type={"string"} required>
625+
The ID of the terminal to kill.
626+
</ResponseField>
602627

603628
<a id="terminal-output"></a>
604629
### <span class="font-mono">terminal/output</span>
@@ -612,6 +637,8 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
612637

613638
#### <span class="font-mono">TerminalOutputRequest</span>
614639

640+
Request to get the current output and status of a terminal.
641+
615642
**Type:** Object
616643

617644
**Properties:**
@@ -620,11 +647,17 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
620647
name="sessionId"
621648
type={<a href="#sessionid">SessionId</a>}
622649
required
623-
></ResponseField>
624-
<ResponseField name="terminalId" type={"string"} required></ResponseField>
650+
>
651+
The session ID for this request.
652+
</ResponseField>
653+
<ResponseField name="terminalId" type={"string"} required>
654+
The ID of the terminal to get output from.
655+
</ResponseField>
625656

626657
#### <span class="font-mono">TerminalOutputResponse</span>
627658

659+
Response containing the terminal output and exit status.
660+
628661
**Type:** Object
629662

630663
**Properties:**
@@ -639,9 +672,15 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
639672
<span> | null</span>
640673
</>
641674
}
642-
></ResponseField>
643-
<ResponseField name="output" type={"string"} required></ResponseField>
644-
<ResponseField name="truncated" type={"boolean"} required></ResponseField>
675+
>
676+
Exit status if the command has completed.
677+
</ResponseField>
678+
<ResponseField name="output" type={"string"} required>
679+
The terminal output captured so far.
680+
</ResponseField>
681+
<ResponseField name="truncated" type={"boolean"} required>
682+
Whether the output was truncated due to byte limits.
683+
</ResponseField>
645684

646685
<a id="terminal-release"></a>
647686
### <span class="font-mono">terminal/release</span>
@@ -661,6 +700,8 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
661700

662701
#### <span class="font-mono">ReleaseTerminalRequest</span>
663702

703+
Request to release a terminal and free its resources.
704+
664705
**Type:** Object
665706

666707
**Properties:**
@@ -669,8 +710,12 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
669710
name="sessionId"
670711
type={<a href="#sessionid">SessionId</a>}
671712
required
672-
></ResponseField>
673-
<ResponseField name="terminalId" type={"string"} required></ResponseField>
713+
>
714+
The session ID for this request.
715+
</ResponseField>
716+
<ResponseField name="terminalId" type={"string"} required>
717+
The ID of the terminal to release.
718+
</ResponseField>
674719

675720
<a id="terminal-wait_for_exit"></a>
676721
### <span class="font-mono">terminal/wait_for_exit</span>
@@ -681,6 +726,8 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
681726

682727
#### <span class="font-mono">WaitForTerminalExitRequest</span>
683728

729+
Request to wait for a terminal command to exit.
730+
684731
**Type:** Object
685732

686733
**Properties:**
@@ -689,21 +736,29 @@ See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminal
689736
name="sessionId"
690737
type={<a href="#sessionid">SessionId</a>}
691738
required
692-
></ResponseField>
693-
<ResponseField name="terminalId" type={"string"} required></ResponseField>
739+
>
740+
The session ID for this request.
741+
</ResponseField>
742+
<ResponseField name="terminalId" type={"string"} required>
743+
The ID of the terminal to wait for.
744+
</ResponseField>
694745

695746
#### <span class="font-mono">WaitForTerminalExitResponse</span>
696747

748+
Response containing the exit status of a terminal command.
749+
697750
**Type:** Object
698751

699752
**Properties:**
700753

701754
<ResponseField name="exitCode" type={"integer | null"} >
755+
The process exit code (may be null if terminated by signal).
702756

703757
- Minimum: `0`
704758

705759
</ResponseField>
706760
<ResponseField name="signal" type={"string | null"} >
761+
The signal that terminated the process (may be null if exited normally).
707762
</ResponseField>
708763

709764
## <span class="font-mono">AgentCapabilities</span>
@@ -1964,16 +2019,20 @@ response to confirm successful cancellation.
19642019

19652020
## <span class="font-mono">TerminalExitStatus</span>
19662021

2022+
Exit status of a terminal command.
2023+
19672024
**Type:** Object
19682025

19692026
**Properties:**
19702027

19712028
<ResponseField name="exitCode" type={"integer | null"} >
2029+
The process exit code (may be null if terminated by signal).
19722030

19732031
- Minimum: `0`
19742032

19752033
</ResponseField>
19762034
<ResponseField name="signal" type={"string | null"} >
2035+
The signal that terminated the process (may be null if exited normally).
19772036
</ResponseField>
19782037

19792038
## <span class="font-mono">TextContent</span>

docs/protocol/terminals.mdx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ The `terminal/create` method starts a command in a new terminal:
5858
</ParamField>
5959

6060
<ParamField path="args" type="string[]">
61-
Optional array of command arguments
61+
Array of command arguments
6262
</ParamField>
6363

6464
<ParamField path="env" type="EnvVariable[]">
65-
Optional environment variables for the command.
65+
Environment variables for the command.
6666

6767
Each variable has:
6868

@@ -72,12 +72,20 @@ Each variable has:
7272
</ParamField>
7373

7474
<ParamField path="cwd" type="string">
75-
Optional working directory for the command (absolute path)
75+
Working directory for the command (absolute path)
7676
</ParamField>
7777

7878
<ParamField path="outputByteLimit" type="number">
79-
Optional maximum number of output bytes to retain. Once exceeded, earlier
80-
output is truncated to stay within this limit.
79+
Maximum number of output bytes to retain. Once exceeded, earlier output is
80+
truncated to stay within this limit.
81+
82+
When the limit is exceeded, the Client truncates from the beginning of the output
83+
to stay within the limit.
84+
85+
The Client **MUST** ensure truncation happens at a character boundary to maintain valid
86+
string output, even if this means the retained output is slightly less than the
87+
specified limit.
88+
8189
</ParamField>
8290

8391
The Client returns a Terminal ID immediately without waiting for completion:

rust/client.rs

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,10 @@ pub struct ReadTextFileRequest {
340340
pub session_id: SessionId,
341341
/// Absolute path to the file to read.
342342
pub path: PathBuf,
343-
/// Optional line number to start reading from (1-based).
343+
/// Line number to start reading from (1-based).
344344
#[serde(default, skip_serializing_if = "Option::is_none")]
345345
pub line: Option<u32>,
346-
/// Optional maximum number of lines to read.
346+
/// Maximum number of lines to read.
347347
#[serde(default, skip_serializing_if = "Option::is_none")]
348348
pub limit: Option<u32>,
349349
}
@@ -368,82 +368,119 @@ impl std::fmt::Display for TerminalId {
368368
}
369369
}
370370

371+
/// Request to create a new terminal and execute a command.
371372
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
372373
#[serde(rename_all = "camelCase")]
373374
#[schemars(extend("x-side" = "client", "x-method" = TERMINAL_CREATE_METHOD_NAME))]
374375
pub struct CreateTerminalRequest {
376+
/// The session ID for this request.
375377
pub session_id: SessionId,
378+
/// The command to execute.
376379
pub command: String,
380+
/// Array of command arguments.
377381
#[serde(default, skip_serializing_if = "Vec::is_empty")]
378382
pub args: Vec<String>,
383+
/// Environment variables for the command.
379384
#[serde(default, skip_serializing_if = "Vec::is_empty")]
380385
pub env: Vec<crate::EnvVariable>,
386+
/// Working directory for the command (absolute path).
381387
#[serde(default, skip_serializing_if = "Option::is_none")]
382388
pub cwd: Option<PathBuf>,
389+
/// Maximum number of output bytes to retain.
390+
///
391+
/// When the limit is exceeded, the Client truncates from the beginning of the output
392+
/// to stay within the limit.
393+
///
394+
/// The Client MUST ensure truncation happens at a character boundary to maintain valid
395+
/// string output, even if this means the retained output is slightly less than the
396+
/// specified limit.
383397
#[serde(default, skip_serializing_if = "Option::is_none")]
384398
pub output_byte_limit: Option<u64>,
385399
}
386400

401+
/// Response containing the ID of the created terminal.
387402
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
388403
#[serde(rename_all = "camelCase")]
389404
#[schemars(extend("x-side" = "client", "x-method" = TERMINAL_CREATE_METHOD_NAME))]
390405
pub struct CreateTerminalResponse {
406+
/// The unique identifier for the created terminal.
391407
pub terminal_id: TerminalId,
392408
}
393409

410+
/// Request to get the current output and status of a terminal.
394411
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
395412
#[serde(rename_all = "camelCase")]
396413
#[schemars(extend("x-side" = "client", "x-method" = TERMINAL_OUTPUT_METHOD_NAME))]
397414
pub struct TerminalOutputRequest {
415+
/// The session ID for this request.
398416
pub session_id: SessionId,
417+
/// The ID of the terminal to get output from.
399418
pub terminal_id: TerminalId,
400419
}
401420

421+
/// Response containing the terminal output and exit status.
402422
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
403423
#[serde(rename_all = "camelCase")]
404424
#[schemars(extend("x-side" = "client", "x-method" = TERMINAL_OUTPUT_METHOD_NAME))]
405425
pub struct TerminalOutputResponse {
426+
/// The terminal output captured so far.
406427
pub output: String,
428+
/// Whether the output was truncated due to byte limits.
407429
pub truncated: bool,
430+
/// Exit status if the command has completed.
408431
pub exit_status: Option<TerminalExitStatus>,
409432
}
410433

434+
/// Request to release a terminal and free its resources.
411435
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
412436
#[serde(rename_all = "camelCase")]
413437
#[schemars(extend("x-side" = "client", "x-method" = TERMINAL_RELEASE_METHOD_NAME))]
414438
pub struct ReleaseTerminalRequest {
439+
/// The session ID for this request.
415440
pub session_id: SessionId,
441+
/// The ID of the terminal to release.
416442
pub terminal_id: TerminalId,
417443
}
418444

445+
/// Request to kill a terminal command without releasing the terminal.
419446
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
420447
#[serde(rename_all = "camelCase")]
421448
#[schemars(extend("x-side" = "client", "x-method" = TERMINAL_KILL_METHOD_NAME))]
422449
pub struct KillTerminalCommandRequest {
450+
/// The session ID for this request.
423451
pub session_id: SessionId,
452+
/// The ID of the terminal to kill.
424453
pub terminal_id: TerminalId,
425454
}
426455

456+
/// Request to wait for a terminal command to exit.
427457
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
428458
#[serde(rename_all = "camelCase")]
429459
#[schemars(extend("x-side" = "client", "x-method" = TERMINAL_WAIT_FOR_EXIT_METHOD_NAME))]
430460
pub struct WaitForTerminalExitRequest {
461+
/// The session ID for this request.
431462
pub session_id: SessionId,
463+
/// The ID of the terminal to wait for.
432464
pub terminal_id: TerminalId,
433465
}
434466

467+
/// Response containing the exit status of a terminal command.
435468
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
436469
#[serde(rename_all = "camelCase")]
437470
#[schemars(extend("x-side" = "client", "x-method" = TERMINAL_WAIT_FOR_EXIT_METHOD_NAME))]
438471
pub struct WaitForTerminalExitResponse {
472+
/// The exit status of the terminal command.
439473
#[serde(flatten)]
440474
pub exit_status: TerminalExitStatus,
441475
}
442476

477+
/// Exit status of a terminal command.
443478
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
444479
#[serde(rename_all = "camelCase")]
445480
pub struct TerminalExitStatus {
481+
/// The process exit code (may be null if terminated by signal).
446482
pub exit_code: Option<u32>,
483+
/// The signal that terminated the process (may be null if exited normally).
447484
pub signal: Option<String>,
448485
}
449486

0 commit comments

Comments
 (0)