Skip to content

fix: implement getJsonSchema and harden OAuth/tool payloads - #5

Merged
superdav42 merged 1 commit into
mainfrom
fix/getjsonschema-and-tools-payload
Apr 7, 2026
Merged

superdav42 merged 1 commit into
mainfrom
fix/getjsonschema-and-tools-payload

Conversation

@superdav42

Copy link
Copy Markdown
Contributor

Summary

  • Resolves fatal error where `AnthropicOAuthRequestAuthentication` was abstract due to the missing `getJsonSchema()` method required by `WithJsonSchemaInterface`. Now extends `ApiKeyRequestAuthentication` and provides an empty schema (tokens come from the pool, not user input).
  • Always prepends the Claude Code system identifier — the OAuth gateway returns a misleading 401 without it.
  • Normalizes tool `input_schema` so empty `properties` serialize as `{}` (not `[]`) and list-style `items` are coerced to `{}`, satisfying Anthropic's draft-2020-12 validator.
  • Strips `#state` fragment from authorization codes before token exchange.
  • Logs token-refresh failures to `debug.log`.
  • Drops `strict_types` from `plugin.php` bootstrap (incompatible with the WP plugin loader).

Test plan

  • Plugin activates without fatal
  • OAuth login completes end-to-end
  • Chat with tools works through the Anthropic Max provider

…th robustness

- AnthropicOAuthRequestAuthentication now extends ApiKeyRequestAuthentication
  and implements getJsonSchema(), resolving a fatal where the class was
  abstract due to the unimplemented WithJsonSchemaInterface method.
- Prepend the Claude Code system identifier to every request — the OAuth
  gateway returns a misleading 401 without it.
- Recursively coerce empty tool input_schema.properties to stdClass and
  fix list-style items so Anthropic's draft-2020-12 validator accepts them.
- Strip "#state" fragment from authorization codes before token exchange.
- Log token-refresh failures to debug.log for diagnosis.
- Drop strict_types from plugin.php bootstrap (incompatible with WP loader).

Co-Authored-By: Claude Opus 4.6 (1M context) <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