Skip to content

Commit cf035bb

Browse files
cole-millerDavidagu-z
committed
Clarify that all file paths are absolute
Co-authored-by: David <davidsk@zed.dev> Co-authored-by: Agus <agus@zed.dev>
1 parent 06bdaef commit cf035bb

7 files changed

Lines changed: 30 additions & 22 deletions

File tree

docs/protocol/file-system.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The `fs/read_text_file` method allows Agents to read text file contents from the
3838
"method": "fs/read_text_file",
3939
"params": {
4040
"sessionId": "sess_abc123def456",
41-
"path": "src/main.py",
41+
"path": "/home/user/project/src/main.py",
4242
"line": 10,
4343
"limit": 50
4444
}
@@ -50,7 +50,7 @@ The `fs/read_text_file` method allows Agents to read text file contents from the
5050
</ParamField>
5151

5252
<ParamField path="path" type="string" required>
53-
Path to the file to read
53+
Absolute path to the file to read
5454
</ParamField>
5555

5656
<ParamField path="line" type="number">
@@ -84,7 +84,7 @@ The `fs/write_text_file` method allows Agents to write or update text files in t
8484
"method": "fs/write_text_file",
8585
"params": {
8686
"sessionId": "sess_abc123def456",
87-
"path": "config.json",
87+
"path": "/home/user/project/config.json",
8888
"content": "{\n \"debug\": true,\n \"version\": \"1.0.0\"\n}"
8989
}
9090
}
@@ -95,7 +95,8 @@ 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-
Path to the file to write.
98+
Absolute path to the file to write.
99+
99100
The Client **MUST** create the file if it doesn't exist.
100101
</ParamField>
101102

docs/protocol/overview.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ Clients provide the interface between users and agents. They are typically code
9494
Send progress updates during prompt processing (no response expected).
9595
</ParamField>
9696

97+
## Argument requirements
98+
99+
- All file paths in the protocol **MUST** be absolute.
100+
- Line numbers are 1-based
101+
97102
## Error Handling
98103

99104
All methods follow standard JSON-RPC 2.0 [error handling](https://www.jsonrpc.org/specification#error_object):

docs/protocol/session-setup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ Each MCP server specification includes:
207207
</ParamField>
208208

209209
<ParamField path="command" type="string" required>
210-
The path to the MCP server executable
210+
The absolute path to the MCP server executable
211211
</ParamField>
212212

213213
<ParamField path="args" type="array" required>

docs/protocol/tool-calls.mdx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ When the language model requests a tool invocation, the Agent **SHOULD** report
4242
The category of tool being invoked.
4343

4444
<Expandable title="kinds">
45-
- `read` - Reading files or data - `edit` - Modifying files or content -
46-
`delete` - Removing files or data - `move` - Moving or renaming files -
47-
`search` - Searching for information - `execute` - Running commands or code -
48-
`think` - Internal reasoning or planning - `fetch` - Retrieving external data
45+
- `read` - Reading files or data
46+
- `edit` - Modifying files or content
47+
- `delete` - Removing files or data
48+
- `move` - Moving or renaming files
49+
- `search` - Searching for information
50+
- `execute` - Running commands or code
51+
- `think` - Internal reasoning or planning
52+
- `fetch` - Retrieving external data
4953
- `other` - Other tool types (default)
5054
</Expandable>
5155

@@ -251,14 +255,14 @@ File modifications shown as diffs:
251255
```json
252256
{
253257
"type": "diff",
254-
"path": "src/config.json",
258+
"path": "/home/user/project/src/config.json",
255259
"oldText": "{\n \"debug\": false\n}",
256260
"newText": "{\n \"debug\": true\n}"
257261
}
258262
```
259263

260264
<ParamField path="path" type="string" required>
261-
The file path being modified
265+
The absolute file path being modified
262266
</ParamField>
263267

264268
<ParamField path="oldText" type="string">
@@ -275,13 +279,13 @@ Tool calls can report file locations they're working with, enabling Clients to i
275279

276280
```json
277281
{
278-
"path": "src/main.py",
282+
"path": "/home/user/project/src/main.py",
279283
"line": 42
280284
}
281285
```
282286

283287
<ParamField path="path" type="string" required>
284-
The file path being accessed or modified
288+
The absolute file path being accessed or modified
285289
</ParamField>
286290

287291
<ParamField path="line" type="number">

rust/client.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,9 @@ pub enum RequestPermissionOutcome {
208208
pub struct WriteTextFileRequest {
209209
/// The session ID for this request.
210210
pub session_id: SessionId,
211-
/// Path to the file to write (relative to the session's working directory).
211+
/// Absolute path to the file to write.
212212
pub path: PathBuf,
213213
/// The text content to write to the file.
214-
/// The text content read from the file.
215214
pub content: String,
216215
}
217216

@@ -225,7 +224,7 @@ pub struct WriteTextFileRequest {
225224
pub struct ReadTextFileRequest {
226225
/// The session ID for this request.
227226
pub session_id: SessionId,
228-
/// Path to the file to read (relative to the session's working directory).
227+
/// Absolute path to the file to read.
229228
pub path: PathBuf,
230229
/// Optional line number to start reading from (1-based).
231230
#[serde(default, skip_serializing_if = "Option::is_none")]

schema/schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@
809809
"type": ["integer", "null"]
810810
},
811811
"path": {
812-
"description": "Path to the file to read (relative to the session's working directory).",
812+
"description": "Absolute path to the file to read.",
813813
"type": "string"
814814
},
815815
"sessionId": {
@@ -1436,11 +1436,11 @@
14361436
"description": "Request to write content to a text file.\n\nOnly available if the client supports the `fs.writeTextFile` capability.",
14371437
"properties": {
14381438
"content": {
1439-
"description": "The text content to write to the file.\nThe text content read from the file.",
1439+
"description": "The text content to write to the file.",
14401440
"type": "string"
14411441
},
14421442
"path": {
1443-
"description": "Path to the file to write (relative to the session's working directory).",
1443+
"description": "Absolute path to the file to write.",
14441444
"type": "string"
14451445
},
14461446
"sessionId": {

typescript/schema.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,10 @@ export type AgentClientProtocol = z.infer<typeof agentClientProtocolSchema>;
122122
export const writeTextFileRequestSchema = z.object({
123123
/**
124124
* The text content to write to the file.
125-
* The text content read from the file.
126125
*/
127126
content: z.string(),
128127
/**
129-
* Path to the file to write (relative to the session's working directory).
128+
* Absolute path to the file to write.
130129
*/
131130
path: z.string(),
132131
/**
@@ -150,7 +149,7 @@ export const readTextFileRequestSchema = z.object({
150149
*/
151150
line: z.number().optional().nullable(),
152151
/**
153-
* Path to the file to read (relative to the session's working directory).
152+
* Absolute path to the file to read.
154153
*/
155154
path: z.string(),
156155
/**

0 commit comments

Comments
 (0)