Skip to content

Commit 2ca56d6

Browse files
committed
Add methods docs to typescript
1 parent 5953b3b commit 2ca56d6

File tree

7 files changed

+346
-64
lines changed

7 files changed

+346
-64
lines changed

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
All paths in the protocol should be absolute
2+
3+
When updating JSON-RPC methods, their params, or output:
4+
5+
- Update the mintlify docs and guides in the `docs` directory
6+
- Run `npm run check` to make sure the json and zod schemas gets generated properly
7+
- Params and responses docs make it to the schema, but the method-level docs, so make sure to update the typescript library accordingly.

docs/protocol/file-system.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The `fs/write_text_file` method allows Agents to write or update text files in t
9595
</ParamField>
9696

9797
<ParamField path="path" type="string" required>
98-
Absolute path to the file to write.
98+
Absolute path to the file to write.
9999

100100
The Client **MUST** create the file if it doesn't exist.
101101

docs/protocol/initialization.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ The Agent **SHOULD** specify whether it supports the following capabilities:
119119
</ResponseField>
120120

121121
<ResponseField name="promptCapabilities" type="PromptCapabilities Object">
122-
Object indicating the different types of [content](./content) that may be included in
123-
`session/prompt` requests.
122+
Object indicating the different types of [content](./content) that may be
123+
included in `session/prompt` requests.
124124
</ResponseField>
125125

126126
#### Prompt capabilities

docs/protocol/overview.mdx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ A typical conversation follows this pattern:
2020

2121
<Steps>
2222
<Step title="Initialization Phase">
23-
- Client → Agent: `initialize` to establish connection
24-
- Client → Agent: `authenticate` if required by the Agent
23+
24+
- Client → Agent: `initialize` to establish connection
25+
- Client → Agent: `authenticate` if required by the Agent
26+
2527
</Step>
2628

27-
<Step title="Session Setup">
28-
Either:
29-
- Client → Agent: `session/new` to create a new session
30-
- Client → Agent: `session/load` to resume an existing session if supported
29+
<Step title="Session Setup - either:">
30+
31+
- Client → Agent: `session/new` to create a new session
32+
- Client → Agent: `session/load` to resume an existing session if supported
33+
3134
</Step>
3235

3336
<Step title="Prompt Turn">
@@ -64,13 +67,15 @@ Agents are programs that use generative AI to autonomously modify code. They typ
6467
### Optional Methods
6568

6669
<ParamField path="session/load">
67-
[Load an existing session](./session-setup#loading-sessions) (requires `loadSession` capability).
70+
[Load an existing session](./session-setup#loading-sessions) (requires
71+
`loadSession` capability).
6872
</ParamField>
6973

7074
### Notifications
7175

7276
<ParamField path="session/cancel">
73-
[Cancel ongoing operations](./prompt-turn#cancellation) (no response expected).
77+
[Cancel ongoing operations](./prompt-turn#cancellation) (no response
78+
expected).
7479
</ParamField>
7580

7681
## Client
@@ -80,23 +85,27 @@ Clients provide the interface between users and agents. They are typically code
8085
### Baseline Methods
8186

8287
<ParamField path="session/request_permission">
83-
[Request user authorization](./tool-calls#requesting-permission) for tool calls.
88+
[Request user authorization](./tool-calls#requesting-permission) for tool
89+
calls.
8490
</ParamField>
8591

8692
### Optional Methods
8793

8894
<ParamField path="fs/read_text_file">
89-
[Read file contents](./file-system#reading-files) (requires `fs.readTextFile` capability).
95+
[Read file contents](./file-system#reading-files) (requires `fs.readTextFile`
96+
capability).
9097
</ParamField>
9198

9299
<ParamField path="fs/write_text_file">
93-
[Write file contents](./file-system#writing-files) (requires `fs.writeTextFile` capability).
100+
[Write file contents](./file-system#writing-files) (requires
101+
`fs.writeTextFile` capability).
94102
</ParamField>
95103

96104
### Notifications
97105

98106
<ParamField path="session/update">
99-
[Send progress updates](./prompt-turn#3-agent-reports-output) during prompt processing (no response expected).
107+
[Send progress updates](./prompt-turn#3-agent-reports-output) during prompt
108+
processing (no response expected).
100109
</ParamField>
101110

102111
## Argument requirements

rust/agent.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub trait Agent {
4848
/// Creates a new conversation session with the agent.
4949
///
5050
/// Sessions represent independent conversation contexts with their own history and state.
51+
///
5152
/// The agent should:
5253
/// - Create a new session context
5354
/// - Connect to any specified MCP servers
@@ -66,6 +67,7 @@ pub trait Agent {
6667
/// Loads an existing session to resume a previous conversation.
6768
///
6869
/// This method is only available if the agent advertises the `loadSession` capability.
70+
///
6971
/// The agent should:
7072
/// - Restore the session context and conversation history
7173
/// - Connect to the specified MCP servers
@@ -79,9 +81,11 @@ pub trait Agent {
7981

8082
/// Processes a user prompt within a session.
8183
///
82-
/// This is the core interaction method where the agent:
84+
/// This method handles the whole lifecycle of a prompt:
8385
/// - Receives user messages with optional context (files, images, etc.)
8486
/// - Processes the prompt using language models
87+
/// - Reports language model content and tool calls to the Clients
88+
/// - Requests permission to run tools
8589
/// - Executes any requested tool calls
8690
/// - Returns when the turn is complete with a stop reason
8791
///

0 commit comments

Comments
 (0)