Skip to content

Sweep legacy tool parameter schemas after PR #1900 normalizer removal #1921

@chubes4

Description

@chubes4

Summary

PR #1900 ("Require canonical AI tool schemas") removed RequestBuilder::normalizeToolParameters auto-normalization, but did not sweep DM's own tool registrations. Multiple core handlers and tools still emit the legacy property-keyed shape ({name => {type, required: true|false, description}}) which now fails OpenAI provider validation post-0.106.1.

Affected scopes

Three distinct buckets, all using the same legacy shape, all need the same canonical conversion ({type: object, properties: {...}, required: [...]}):

1. Chat tools (inc/Api/Chat/Tools/)

~30 files. Each getToolDefinition() returns a parameters block in legacy property-keyed shape. Spot-checked:

  • CreatePipeline.php
  • ManageQueue.php, ListFlows.php, AssignTaxonomyTerm.php, GetProblemFlows.php, ReorderPipelineSteps.php, GetHandlerDefaults.php, SetHandlerDefaults.php, ConfigurePipelineStep.php, SendPing.php, DeleteFlow.php, AddPipelineStep.php, DeleteFile.php, UpdateFlow.php, DeletePipeline.php, CreateFlow.php, CreateTaxonomyTerm.php, ReadLogs.php, MergeTaxonomyTerms.php, ManageJobs.php, DeletePipelineStep.php, ExecuteWorkflowTool.php, SearchTaxonomyTerms.php, SystemHealthCheck.php, AuthenticateHandler.php, ConfigureFlowSteps.php, ManageLogs.php, UpdateTaxonomyTerm.php, ApiQuery.php, CopyFlow.php, RunFlow.php

2. Global AI tools (inc/Engine/AI/Tools/Global/)

7 files. Some may be settings-UI rather than tool schemas — needs per-file verification:

  • BingWebmaster.php, AmazonAffiliateLink.php, GoogleSearchConsole.php, GoogleSearch.php, ImageGeneration.php, GoogleAnalytics.php, PageSpeed.php

3. Handler tool registrations (inc/Core/Steps/Publish/Handlers/)

2 files. Same pattern as the just-fixed data-machine-events/EventUpsertFilters (Extra-Chill/data-machine-events#235):

  • WordPress/WordPress.phpwordpress_publish tool, lines ~47–80; merges with TaxonomyHandler::getTaxonomyToolParameters() output
  • Email/Email.phpemail_publish tool, lines ~45–70

Out of scope (do NOT touch)

These also use required: true|false but legitimately, per WordPress conventions:

  • inc/Api/** (non-Chat) — WP REST API args definitions consumed by register_rest_route(). Property-level required is the official WP REST contract.
  • inc/Core/Steps/**Settings.php, inc/Core/Steps/**Auth.php, inc/Core/Steps/SystemTask/SystemTaskSettings.php — DM's own settings-UI form field defs, separate convention.
  • inc/Abilities/** input/output schemas — these follow the WP Abilities API spec and are consumed by abilities, not sent to OpenAI directly. Any change here needs a separate audit (filed as follow-up).

Conversion rules

Identical to the rules used in Extra-Chill/data-machine-events#232 and #235:

  1. Wrap properties under { 'type' => 'object', 'properties' => array(...), 'required' => array(...) }.
  2. Move every property where required => true into the top-level required[] string list.
  3. Drop required => false entirely (no-op).
  4. Omit required key if no required properties (don't emit empty array).
  5. Every type: array property must declare items (OpenAI strict mode requirement). Use items: { type: object } for structured items, items: { type: string } for string lists.
  6. Preserve all other property keys (description, enum, etc.).

For the handler-tool registrations in scope 3, the merge logic also needs adjusting — TaxonomyHandler::getTaxonomyToolParameters() already returns shape-compatible bare-properties (no required flags, items present on arrays), so the registration site can wrap the merged result in the canonical envelope without touching TaxonomyHandler itself.

Backwards compatibility

Canonical schemas are accepted by both DM 0.103.x (passthrough via the still-present normalizer in older versions) and DM 0.106.1+ (passthrough literal). Safe to merge ahead of any deploy.

Proposed dispatch

Three parallel PRs from three minions, one per scope above. Tracked by this issue.

Why now

Blocks DM 0.106.1 deploy on extrachill.com. Will block deploy on every site using these handlers/tools.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions