Skip to content

inputSchema with ZodRawShape #891

@lanluu

Description

@lanluu

I am using the latest release 1.17.3.

I registered a tool as below

server.registerTool(
        "get_file_contents",
        {
            title: "Fetch File Content",
            description: "Fetches the content of a file from either Github or Gitea, given repository details and authentication token.",
            inputSchema: {
                url: z.string().describe("The base URL of the repository (Github or Gitea)."),
                token: z.string().describe("Authentication token for the repository."),
                branch: z.string().describe("The branch name to fetch the file from."),
                owner: z.string().describe("The owner of the repository."),
                repo: z.string().describe("The name of the repository."),
                path: z.string().describe("The path to the file within the repository.")
            }
        },
...

Well, as registerTool expects an inputSchema as ZodRawShape, my given code should work. But in this case, the following error appeared by each property of inputSchema:

Type 'ZodString' is missing the following properties from type 'ZodType<any, any, any>': _type, _parse, _getType, _getOrReturnCtx, and 7 more.ts(2740)
types.d.cts(14, 5): The expected type comes from this index signature.

Any tip or help is much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions