- Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
There's a type mistake in the mcp_call response output item. The type of item.error says it should be string | null, but I received an object with multiple properties. Not sure if the issue is the type definition, or if the error wasn't turned into a string somewhere else.
Here's the type definition of McpCall:
export interface McpCall { /** * The unique ID of the tool call. */ id: string; /** * A JSON string of the arguments passed to the tool. */ arguments: string; /** * The name of the tool that was run. */ name: string; /** * The label of the MCP server running the tool. */ server_label: string; /** * The type of the item. Always `mcp_call`. */ type: 'mcp_call'; /** * The error from the tool call, if any. */ error?: string | null; /** * The output from the tool call. */ output?: string | null; }And here's an mcp_call item I just got from the responses API:
const item = { id: 'mcp_68653a694bec8198a308e96e37ba509b09483f21bc1f2ea7', type: 'mcp_call', approval_request_id: null, arguments: '{"query":"latest tech gadgets"}', error: { type: 'mcp_protocol_error', code: 32600, message: 'Session terminated' }, name: 'search', output: null, server_label: 'my-mcp-server' }To Reproduce
Use the responses API like this:
const response = await openaiClient.responses.create({ input: "Hello world, please call a tool", model: 'gpt-4o', tools: [ { require_approval: 'never', server_label: 'my-mcp-server', server_url: mcpServerUrl, type: 'mcp', }, ], });Have a failing MCP server (not sure what the actual underlying Session terminated error is) that generated this kind of error.
Code snippets
OS
macOS
Node version
v20
Library version
openai v5.8.2