Skip to content

test(filesystem): extend structured-content integration coverage to all 14 tools - #4046

Closed
yakuphanycl wants to merge 1 commit into
modelcontextprotocol:mainfrom
yakuphanycl:feat/extend-structured-content-tests-all-tools
Closed

test(filesystem): extend structured-content integration coverage to all 14 tools#4046
yakuphanycl wants to merge 1 commit into
modelcontextprotocol:mainfrom
yakuphanycl:feat/extend-structured-content-tests-all-tools

Conversation

@yakuphanycl

Copy link
Copy Markdown

Summary

The existing structured-content.test.ts only covered 5 of 14 registered tools. This PR extends integration coverage to all 14 tools (16 test cases), closing the regression class for the full tool surface.

New test coverage

Tool outputSchema type Assertions
read_text_file string content match
read_file (deprecated) string back-compat parity with read_text_file
read_multiple_files string both file paths present
write_file string success message + on-disk verification
edit_file string diff output + on-disk edit verification
edit_file (dryRun) string diff output + file unchanged
create_directory string success message + fs.stat + idempotency
get_file_info string metadata contains size
list_allowed_directories string contains "Allowed directories"
read_media_file array array shape, image type, image/png mime, base64 data

Previously covered (preserved)

directory_tree, list_directory_with_sizes, move_file, list_directory, search_files

Motivation

Issues #3110, #3106, #3093 identified a structuredContent shape bug (content was an array instead of a string). The original test file verified the fix for 5 tools; the remaining 9 tools had no regression coverage. This PR ensures any future schema drift is caught at test time for the entire tool surface.

read_media_file note

read_media_file is the only tool whose outputSchema declares content as an array (of { type, data, mimeType } objects). The test asserts the current shape. A TODO comment references a pending envelope reconciliation tracked separately.

Test plan

  • npx vitest run __tests__/structured-content.test.ts — 16/16 pass
  • npx vitest run — full suite: 156 pass, 1 pre-existing Windows-specific failure in path-validation.test.ts (unrelated, isPathWithinAllowedDirectories('D:\other', ['/']))
  • npm run build — tsc clean (test files excluded via tsconfig)
  • No changes to source code (index.ts, lib.ts, etc.) — test-only PR

…ll 14 tools

The existing test file only covered 5 of 14 tools (directory_tree,
list_directory_with_sizes, move_file, list_directory, search_files).

This commit adds integration tests for the remaining 9 tools:
- read_text_file, read_file (deprecated back-compat), read_multiple_files
- write_file (with on-disk verification)
- edit_file (live edit + dryRun variant)
- create_directory (with idempotency check)
- get_file_info, list_allowed_directories
- read_media_file (array outputSchema, minimal PNG fixture)

Each test asserts that structuredContent.content matches the declared
outputSchema type (string for 13 tools, array for read_media_file),
closing the regression class identified in #3110, #3106, #3093 for
the full tool surface.

Coverage: 5/14 → 14/14 tools, 5 → 16 test cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yakuphanycl yakuphanycl closed this by deleting the head repository May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant