Skip to content

fix(tool): align JSON contract with conditional fetch fields#129

Merged
chaliy merged 1 commit into
mainfrom
2026-05-17-fix-conditional-fetch-in-tool-json
May 17, 2026
Merged

fix(tool): align JSON contract with conditional fetch fields#129
chaliy merged 1 commit into
mainfrom
2026-05-17-fix-conditional-fetch-in-tool-json

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 17, 2026

Motivation

  • Typed FetchRequest and FetchResponse gained conditional-fetch fields (if_none_match, if_modified_since, etag) but the tool JSON contract (argument validator and input/output schemas) was not updated, causing JSON/MCP callers to be rejected and tooling to fail strict schema validation.
  • This PR fixes the API contract divergence so JSON callers and strict schema consumers see the same fields the typed Rust API uses.

Description

  • Allow if_none_match and if_modified_since in the tool argument validator by updating validate_args in crates/fetchkit/src/tool.rs.
  • Add if_none_match and if_modified_since to the input schema in build_input_schema with string types and descriptions so the tool definition advertises the fields.
  • Add etag to the output schema in build_output_schema so serialized FetchResponse objects match the advertised schema.
  • Add/extend unit tests to assert the input/output schemas expose the new fields and to ensure Tool::execution accepts conditional fetch arguments (test_execution_accepts_conditional_fetch_arguments, and updated test_tool_schemas).

Testing

  • Ran cargo fmt --all which completed successfully.
  • Ran targeted unit tests: cargo test -p fetchkit test_tool_schemas and cargo test -p fetchkit test_execution_accepts_conditional_fetch_arguments, both of which passed.
  • Verified the updated tests in crates/fetchkit/src/tool.rs exercise schema exposure and argument validation and succeeded in CI-like local test runs.

Codex Task

@chaliy chaliy force-pushed the 2026-05-17-fix-conditional-fetch-in-tool-json branch from e555f5a to 6cb3c12 Compare May 17, 2026 19:15
@chaliy chaliy merged commit 8ca06c0 into main May 17, 2026
11 checks passed
@chaliy chaliy deleted the 2026-05-17-fix-conditional-fetch-in-tool-json branch May 17, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant