Skip to content

coerceInputForSchema is a no-op for $ref / allOf array & object params #424

@mgoldsborough

Description

@mgoldsborough

Context

coerceInputForSchema (src/tools/coerce-input.ts) recovers string-encoded object/array arguments by using the declared schema as a parsing oracle. Per its own docs, $ref and allOf are out of scope: a property declared via either passes through unchanged, so effectiveSchemaFor returns an untyped node, declaresType is false, and no coercion happens.

Gap

If an upstream tool expresses an array/object parameter via $ref or allOf (rather than a flat type: "array" / type: "object"), a string-encoded value for that parameter is not recovered and will reach the wire, where a strict validator rejects it. Composio's current OUTLOOK_CREATE_DRAFT schema uses a flat type: "array" for to_recipients, so #422 covers it — but the class isn't fully closed.

Suggested fix

Add minimal $ref resolution (within the same document, against $defs) and allOf merging to structuralBranches / effectiveSchemaFor, with tests. Keep it conservative: only resolve when it yields a single concrete structural branch, matching the existing union-resolution policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions