fix(server): support two-arg no-schema task handlers#2009
fix(server): support two-arg no-schema task handlers#2009Genmin wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 4411b7e The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
Pushed a focused follow-up for the build failure. The no-schema task callback helper is now inlined into the exported handler aliases so TypeDoc no longer sees a private referenced type. Validation:
|
|
Checked the remaining failing job. The Deno runtime check is failing before repo install/test execution while
All repo build/typecheck/lint/test jobs are green after the follow-up commit, so this looks transient/infrastructure rather than a code failure. |
What changed
Fixes #1471 by allowing no-input-schema task handlers to receive task context as the second argument when they are written in the common
(_args, ctx)form.The executor still preserves the existing context-only
(ctx)path for no-schema handlers, so current TypeScript users are not forced into a breaking runtime change. The public task handler types now accept either no-schema shape, while schema-backed handlers remain(args, ctx)as before.Why
registerToolTaskcurrently calls no-schemacreateTaskhandlers with a single context argument. JavaScript users, or users bypassing types, can naturally writeasync createTask(_args, ctx), which previously receivedctxasundefinedand failed before creating a task.Validation
pnpm --filter @modelcontextprotocol/server exec vitest run test/server/mcp.tasks.test.tspnpm --filter @modelcontextprotocol/server typecheckpnpm --filter @modelcontextprotocol/server lintpnpm -r typecheck,pnpm -r build,pnpm sync:snippets --check,pnpm -r lint