Skip to content

[openai-agents-typescript] say what an MCP factory returned when it isn't a server - #589

Merged
campoy merged 1 commit into
fix/openai-agents-ts-mcp-factory-functionfrom
fix/openai-agents-ts-mcp-factory-result-message
Nov 16, 2026
Merged

campoy merged 1 commit into
fix/openai-agents-ts-mcp-factory-functionfrom
fix/openai-agents-ts-mcp-factory-result-message

Conversation

@campoy

@campoy campoy commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

What was changed

When an OpenAI Agents TypeScript MCP factory returns something that isn't a server, the Activity error now says what came back:

MCP server factory 'files' returned Promise, not a server with connect(), close(), listTools() and callTool() methods.

Before, it said returned an invalid server for every value. The name helps: undefined points at a missing return, and Promise at an async factory. The error type (MCPServerFactoryTypeError) and the non-retryable flag don't change.

Why?

The review on #529 asked for errors that name the bad value. The Vercel AI SDK (#529), Strands (#535) and Google ADK (#534, #536) plugins do that now. #530 merged before that review, so OpenAI Agents TypeScript is the one left.

This PR is stacked on #555, which adds the describeValue helper it uses. Merge #555 first. GitHub then moves this PR to main, and I'll rebase it so the diff shows only this change.

Checklist

  1. Closes: no issue. Follow-up to Breaking: reject invalid MCP factories in OpenAI Agents TypeScript #530.

  2. How was this tested:

    • The existing test in mcp-provider.test.ts now checks the full message for each invalid result: undefined, null, a number, a plain object, a Promise and an incomplete server. It fails with the old message and passes with the new one.
    • On macOS with Node 22: the TypeScript build and the mcp-provider test file (6 passed).
    • In a Linux container with Node 24: ESLint (0 errors; the 8 warnings are the existing ActivityOptions ones). I left the full make test to CI.
  3. Any docs updates needed? No. The README doesn't quote the message.

…'t a server

The error now names the value, as the Vercel AI SDK, Strands and Google
ADK plugins do: MCP server factory 'files' returned Promise, not a server
with connect(), close(), listTools() and callTool() methods.
@campoy
campoy requested a review from a team as a code owner November 16, 2026 18:33
@campoy
campoy merged commit 5179add into fix/openai-agents-ts-mcp-factory-function Nov 16, 2026
13 checks passed
@campoy
campoy deleted the fix/openai-agents-ts-mcp-factory-result-message branch November 16, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant