Skip to content

Use a discriminated-union Zod schema for retrieve_file operations #118

Description

@bharatsachya

Type: refactor · Difficulty: medium

retrieve_file enforces per-operation required fields with runtime throw inside dispatch (packages/mcp/src/retrieveFileTool.ts:111,119,122,133) rather than in the Zod schema (:39). So MCP clients get no schema-level signal that metadata needs relativePaths, content needs relativePath, bulk_search needs paths+search.

Do: model the input as a Zod discriminated union keyed on operation (or superRefine) so required fields per operation are declared in the schema.

Done when: invalid operation payloads are rejected by the schema; the runtime throws become redundant.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions