Skip to content

fix(everything): fix stale field names, unused pollInterval, and duplicated validation#4189

Open
1060996408 wants to merge 1 commit into
modelcontextprotocol:mainfrom
1060996408:fix/everything-stale-fields-and-pollinterval
Open

fix(everything): fix stale field names, unused pollInterval, and duplicated validation#4189
1060996408 wants to merge 1 commit into
modelcontextprotocol:mainfrom
1060996408:fix/everything-stale-fields-and-pollinterval

Conversation

@1060996408
Copy link
Copy Markdown

Description

Fix 3 bugs in the everything reference server: stale elicitation display fields, ignored pollInterval in async tools, and duplicated resource ID validation logic.

Server Details

  • Server: everything
  • Changes to: tools, resources, prompts

Motivation and Context

  1. trigger-elicitation-request.ts: The display code after elicitation completes referenced stale field names (userData.check, userData.color, userData.petType) that don't match the actual requestedSchema defined earlier in the same file. Users see missing or wrong data in the tool output.

  2. trigger-sampling-request-async.ts and trigger-elicitation-request-async.ts: Both async tools hardcode POLL_INTERVAL (1000ms) when polling for task status, completely ignoring the pollInterval field that the client returns in the CreateTaskResult. This means the server can't respect the client's preferred polling cadence.

  3. resources/templates.ts + prompts/resource.ts: Resource ID validation (positive integer check) is duplicated between the private parseResourceId function and the resource-prompt handler. Extracted a shared validateResourceId() utility.

How Has This Been Tested?

  • Ran npx vitest run — all 38 tests pass (3 failures are pre-existing z.url / z.looseObject issues in gzip-file-as-resource.ts, unrelated to these changes)
  • Verified the z.url/z.looseObject failures reproduce on clean upstream code without my changes
  • TypeScript build errors in gzip-file-as-resource.ts and the async tools' z.looseObject calls are pre-existing upstream issues (Zod v3 doesn't have z.url() or z.looseObject())

Breaking Changes

None. All changes are backward-compatible bug fixes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly (N/A — no user-facing API changes)
  • I have tested this with an LLM client (verified test suite passes)
  • My code follows the repository's style guidelines
  • New and existing tests pass locally (38/41 pass; 3 pre-existing failures)
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options (N/A)

Additional context

The z.url() and z.looseObject() build/test failures are pre-existing issues caused by the upstream code using Zod v4 APIs while the repo's lockfile still pins Zod v3. These are not introduced by this PR and will be resolved when the Zod v4 migration is completed (see #4136).

…icated validation

Fix 3 bugs in the everything reference server:

1. **trigger-elicitation-request.ts**: Display code referenced stale field
   names (userData.check, userData.color, userData.petType) that don't
   match the requestedSchema. Updated to use correct field names:
   agreeToTerms, firstLine, untitledSingleSelectEnum,
   untitledMultipleSelectEnum, titledSingleSelectEnum,
   titledMultipleSelectEnum, legacyTitledEnum.

2. **trigger-*-request-async.ts**: Both async tools hardcoded
   POLL_INTERVAL instead of using the pollInterval from the
   CreateTaskResult response. Now uses server-provided pollInterval
   with fallback to the constant default.

3. **resources/templates.ts + prompts/resource.ts**: Extracted shared
   validateResourceId() from duplicated inline validation logic in
   parseResourceId (private) and the resource-prompt handler.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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