Skip to content

Can't define inputSchema as a primitive; prevents ChatGPT connector usage(?) #815

@dylanpyle

Description

@dylanpyle

Describe the bug
My understanding from reading the ChatGPT connector documentation (their limited MCP support) is that MCP servers must implement tools named search and fetch. As arguments/inputs, these must accept "A single query string", and "A string which is a unique identifier for the search document", respectively.

This TypeScript SDK supports Zod shapes/objects as inputs, but not primitives (e.g. just z.string()) as top-level inputs. I'm unclear from reading the MCP spec and other implementations whether this is actually supported in the protocol or something that's abstracted over, but when connecting a custom MCP server to ChatGPT, I receive the following error from ChatGPT:

This MCP server can't be used by ChatGPT to search information because it doesn't implement our specification: search action not found"

— even though my server exposes a search tool which takes { query: z.string() } inputs.

Assuming the issue here is "ChatGPT expects top-level string arguments, this SDK doesn't support it", this bug describes that. Unfortunately ChatGPT's error is fairly opaque and doesn't give much in the way of pointers, so if I'm doing it wrong in some other way, feel free to close.

To Reproduce
Define a tool via

server.registerTool("search",
  {
    title: "Search Tool",
    description: "Add two numbers",
    inputSchema: z.string()
  },
  async (query: string) => ({
    content: [{ type: "text", text: `Search results for ${query}....` }]
  })
);

Expected behavior
This code is allowed

Actual behavior

>  inputSchema: z.string()

Type 'ZodString' is not assignable to type 'ZodRawShape'.
  Index signature for type 'string' is missing in type 'ZodString'

Logs
n/a

Additional context
n/a

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