Repository navigation
[openai-agents-typescript] say what an MCP factory returned when it isn't a server - #589
Merged
campoy merged 1 commit intoNov 16, 2026
Conversation
…'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
merged commit Nov 16, 2026
5179add
into
fix/openai-agents-ts-mcp-factory-function
13 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Before, it said
returned an invalid serverfor every value. The name helps:undefinedpoints at a missingreturn, andPromiseat anasyncfactory. 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
describeValuehelper it uses. Merge #555 first. GitHub then moves this PR tomain, and I'll rebase it so the diff shows only this change.Checklist
Closes: no issue. Follow-up to Breaking: reject invalid MCP factories in OpenAI Agents TypeScript #530.
How was this tested:
mcp-provider.test.tsnow checks the full message for each invalid result:undefined,null, a number, a plain object, aPromiseand an incomplete server. It fails with the old message and passes with the new one.mcp-providertest file (6 passed).ActivityOptionsones). I left the fullmake testto CI.Any docs updates needed? No. The README doesn't quote the message.