Commit 84c2824
# feat(filesystem): add ToolAnnotations hints to filesystem tools (#3045)
**Files touched**
- [src/filesystem/index.ts](../blob/HEAD/src/filesystem/index.ts) — add `annotations` metadata to each tool definition
- [src/filesystem/README.md](../blob/HEAD/src/filesystem/README.md) — document ToolAnnotations mapping for all filesystem tools
## Description
This change adds MCP `ToolAnnotations` (`readOnlyHint`, `idempotentHint`, `destructiveHint`) to all filesystem tools and documents the mapping in the filesystem README. MCP clients can now accurately distinguish read‑only vs. write tools, understand which operations are safe to retry, and highlight potentially destructive actions.
## Server Details
- **Server**: filesystem
- **Area**: tools (metadata returned via `listTools` / `ListToolsRequest`) and server docs
## Motivation and Context
Previously, the filesystem server did not expose ToolAnnotations, so many clients (e.g. ChatGPT Apps) conservatively treated filesystem tools as generic write operations. This led to:
- READ operations being surfaced with WRITE badges and confirmation prompts.
- No way for clients to know which write tools are idempotent or potentially destructive.
This PR aligns the implementation with `servers#2988` and updates the README to clearly document the semantics of each tool. Read‑only operations no longer need to be treated as writes, and destructive/idempotent behavior is explicit for UI and retry logic.
## How Has This Been Tested?
- `npm run build --workspace @modelcontextprotocol/server-filesystem`
- `npm test --workspaces --if-present`
## Breaking Changes
None.
## Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [x] Documentation update
## Checklist
- [x] I have read the [MCP Protocol Documentation](https://modelcontextprotocol.io)
- [x] My changes follows MCP security best practices
- [x] I have updated the server's README accordingly
- [x] I have tested this with an LLM client
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [ ] I have documented all environment variables and configuration options
## Additional context
None.
Co-authored-by: Valeriy_Pavlovich <[email protected]>1 parent 33e029f commit 84c2824
2 files changed
+57
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
178 | 207 | | |
179 | 208 | | |
180 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
| 201 | + | |
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| |||
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | | - | |
| 223 | + | |
| 224 | + | |
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
| |||
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
243 | | - | |
| 245 | + | |
| 246 | + | |
244 | 247 | | |
245 | 248 | | |
246 | 249 | | |
| |||
290 | 293 | | |
291 | 294 | | |
292 | 295 | | |
293 | | - | |
| 296 | + | |
| 297 | + | |
294 | 298 | | |
295 | 299 | | |
296 | 300 | | |
| |||
325 | 329 | | |
326 | 330 | | |
327 | 331 | | |
328 | | - | |
| 332 | + | |
| 333 | + | |
329 | 334 | | |
330 | 335 | | |
331 | 336 | | |
| |||
354 | 359 | | |
355 | 360 | | |
356 | 361 | | |
357 | | - | |
| 362 | + | |
| 363 | + | |
358 | 364 | | |
359 | 365 | | |
360 | 366 | | |
| |||
378 | 384 | | |
379 | 385 | | |
380 | 386 | | |
381 | | - | |
| 387 | + | |
| 388 | + | |
382 | 389 | | |
383 | 390 | | |
384 | 391 | | |
| |||
403 | 410 | | |
404 | 411 | | |
405 | 412 | | |
406 | | - | |
| 413 | + | |
| 414 | + | |
407 | 415 | | |
408 | 416 | | |
409 | 417 | | |
| |||
431 | 439 | | |
432 | 440 | | |
433 | 441 | | |
434 | | - | |
| 442 | + | |
| 443 | + | |
435 | 444 | | |
436 | 445 | | |
437 | 446 | | |
| |||
509 | 518 | | |
510 | 519 | | |
511 | 520 | | |
512 | | - | |
| 521 | + | |
| 522 | + | |
513 | 523 | | |
514 | 524 | | |
515 | 525 | | |
| |||
578 | 588 | | |
579 | 589 | | |
580 | 590 | | |
581 | | - | |
| 591 | + | |
| 592 | + | |
582 | 593 | | |
583 | 594 | | |
584 | 595 | | |
| |||
608 | 619 | | |
609 | 620 | | |
610 | 621 | | |
611 | | - | |
| 622 | + | |
| 623 | + | |
612 | 624 | | |
613 | 625 | | |
614 | 626 | | |
| |||
633 | 645 | | |
634 | 646 | | |
635 | 647 | | |
636 | | - | |
| 648 | + | |
| 649 | + | |
637 | 650 | | |
638 | 651 | | |
639 | 652 | | |
| |||
658 | 671 | | |
659 | 672 | | |
660 | 673 | | |
661 | | - | |
| 674 | + | |
| 675 | + | |
662 | 676 | | |
663 | 677 | | |
664 | 678 | | |
| |||
0 commit comments