Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Dec 19, 2025

Problem

OpenRouter's strict mode validator requires additionalProperties: false on all object-type schemas. The Apify MCP server's call-actor tool had additionalProperties: {} (empty schema = allow any) which was rejected with:

Invalid schema for function 'mcp--apify--call-actor': In context=('properties', 'input'), 'additionalProperties' is required to be supplied and to be false.

Solution

Modified normalizeToolSchema() to:

  1. Force additionalProperties: false on all object-type schemas, even when the original schema explicitly set a different value (like {} or true)
  2. Only add additionalProperties to actual object types (schemas with type: "object" or properties), not to primitive types like strings/numbers/arrays

This ensures MCP tools that expect arbitrary input objects have their schemas normalized for strict mode compatibility.

Testing

  • Updated tests in json-schema.spec.ts and mcp_server.spec.ts to expect the correct behavior
  • All 31 related tests pass

Important

normalizeToolSchema() now enforces additionalProperties: false for object-type schemas to ensure strict mode compatibility, with updated tests verifying this behavior.

  • Behavior:
    • normalizeToolSchema() in json-schema.ts now forces additionalProperties: false for all object-type schemas, overriding any existing values.
    • Ensures additionalProperties is only added to schemas with type: "object" or properties, not to primitive types.
  • Testing:
    • Updated tests in json-schema.spec.ts and mcp_server.spec.ts to verify correct handling of additionalProperties.
    • All 31 related tests pass, confirming strict mode compatibility.

This description was created by Ellipsis for b6deeb7. You can customize this summary. It will automatically update as commits are pushed.

OpenRouter's strict mode validator requires additionalProperties: false on all
object-type schemas. The Apify MCP server's call-actor tool had
additionalProperties: {} (empty schema = allow any) which was rejected.

Changes:
- Force additionalProperties: false on all object types in normalizeToolSchema
- Only add additionalProperties to actual object types, not primitives
- Updated tests to expect correct behavior
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Dec 19, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 19, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly addresses the OpenRouter strict mode compatibility issue by:

  • Only applying additionalProperties: false to object-type schemas (not primitives)
  • Properly detecting object types via explicit type: "object", array syntax, or presence of properties
  • Forcing strict mode compliance even when original schemas allowed arbitrary properties

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 19, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Dec 19, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 19, 2025
@cte cte merged commit aabee0f into main Dec 19, 2025
23 checks passed
@cte cte deleted the fix/openrouter-mcp-strict-mode-schema branch December 19, 2025 20:18
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 19, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants