Skip to content

Commit 5953b3b

Browse files
cole-milleryara-blueagu-z
authored
Clarify that all file paths are absolute (#26)
* Clarify that all file paths are absolute Co-authored-by: David <davidsk@zed.dev> Co-authored-by: Agus <agus@zed.dev> * prettier --------- Co-authored-by: David <davidsk@zed.dev> Co-authored-by: Agus <agus@zed.dev>
1 parent e1c9455 commit 5953b3b

File tree

8 files changed

+28
-35
lines changed

8 files changed

+28
-35
lines changed

docs/docs.json

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@
4444
"groups": [
4545
{
4646
"group": "Overview",
47-
"pages": [
48-
"overview/introduction",
49-
"overview/architecture"
50-
]
47+
"pages": ["overview/introduction", "overview/architecture"]
5148
},
5249
{
5350
"group": "Protocol",
@@ -65,17 +62,11 @@
6562
},
6663
{
6764
"group": "Libraries",
68-
"pages": [
69-
"libraries/typescript",
70-
"libraries/rust"
71-
]
65+
"pages": ["libraries/typescript", "libraries/rust"]
7266
},
7367
{
7468
"group": "Community",
75-
"pages": [
76-
"community/contributing",
77-
"community/versioning"
78-
]
69+
"pages": ["community/contributing", "community/versioning"]
7970
}
8071
]
8172
},
@@ -95,9 +86,6 @@
9586
}
9687
},
9788
"contextual": {
98-
"options": [
99-
"copy",
100-
"view"
101-
]
89+
"options": ["copy", "view"]
10290
}
10391
}

docs/protocol/file-system.mdx

Lines changed: 7 additions & 5 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,8 +95,10 @@ 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.
99-
The Client **MUST** create the file if it doesn't exist.
98+
Absolute path to the file to write.
99+
100+
The Client **MUST** create the file if it doesn't exist.
101+
100102
</ParamField>
101103

102104
<ParamField path="content" type="string" required>

docs/protocol/overview.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ Clients provide the interface between users and agents. They are typically code
9999
[Send progress updates](./prompt-turn#3-agent-reports-output) during prompt processing (no response expected).
100100
</ParamField>
101101

102+
## Argument requirements
103+
104+
- All file paths in the protocol **MUST** be absolute.
105+
- Line numbers are 1-based
106+
102107
## Error Handling
103108

104109
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,14 @@ File modifications shown as diffs:
251251
```json
252252
{
253253
"type": "diff",
254-
"path": "src/config.json",
254+
"path": "/home/user/project/src/config.json",
255255
"oldText": "{\n \"debug\": false\n}",
256256
"newText": "{\n \"debug\": true\n}"
257257
}
258258
```
259259

260260
<ParamField path="path" type="string" required>
261-
The file path being modified
261+
The absolute file path being modified
262262
</ParamField>
263263

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

276276
```json
277277
{
278-
"path": "src/main.py",
278+
"path": "/home/user/project/src/main.py",
279279
"line": 42
280280
}
281281
```
282282

283283
<ParamField path="path" type="string" required>
284-
The file path being accessed or modified
284+
The absolute file path being accessed or modified
285285
</ParamField>
286286

287287
<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
@@ -805,7 +805,7 @@
805805
"type": ["integer", "null"]
806806
},
807807
"path": {
808-
"description": "Path to the file to read (relative to the session's working directory).",
808+
"description": "Absolute path to the file to read.",
809809
"type": "string"
810810
},
811811
"sessionId": {
@@ -1432,11 +1432,11 @@
14321432
"description": "Request to write content to a text file.\n\nOnly available if the client supports the `fs.writeTextFile` capability.",
14331433
"properties": {
14341434
"content": {
1435-
"description": "The text content to write to the file.\nThe text content read from the file.",
1435+
"description": "The text content to write to the file.",
14361436
"type": "string"
14371437
},
14381438
"path": {
1439-
"description": "Path to the file to write (relative to the session's working directory).",
1439+
"description": "Absolute path to the file to write.",
14401440
"type": "string"
14411441
},
14421442
"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)