Skip to content

fix(core): preserve descriptor schemas in ApiRegistry re-wrapping#199

Open
TDannhauer wants to merge 1 commit into
FRAMEWORK_6_0from
fix/api-registry-preserve-schemas
Open

fix(core): preserve descriptor schemas in ApiRegistry re-wrapping#199
TDannhauer wants to merge 1 commit into
FRAMEWORK_6_0from
fix/api-registry-preserve-schemas

Conversation

@TDannhauer

@TDannhauer TDannhauer commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ApiRegistry::getMethodDescriptor() and ::listMethods() re-wrap provider
    descriptors to prefix the interface name (wiki.edit), but dropped the
    inputSchema / outputSchema fields in the process.

Motivation

MethodDescriptor::$inputSchema / $outputSchema are the machine-readable
contract for API discovery: JSON-RPC discovery (rpc.discover) and the MCP
tools/list handler pass them to clients so callers know how to invoke a
method. AI/MCP clients especially depend on explicitly authored JSON schemas —
enums, nested objects, per-property descriptions — to make correct tool calls.
The auto-generated fallback from the flat parameters array cannot express
any of that.

Because the ApiRegistry re-wrap silently discarded these fields, every
discovery consumer saw degraded or empty schemas no matter how carefully a
provider declared them. Any effort to expose Horde app APIs to AI clients via
the MCP layer in horde/rpc is blocked until descriptors survive aggregation
intact, which is how the bug was found.

Changes

  • Route both re-wrap sites through a shared private prefixDescriptor()
    helper that preserves all MethodDescriptor fields.
  • Add regression test testDescriptorSchemasPreserved covering
    getMethodDescriptor() and listMethods().

Test plan

  • test/Unit/Api/ suite passes (20 tests, 35 assertions)
  • New regression test fails on the previous implementation

The inputSchema and outputSchema fields of MethodDescriptor are the
machine-readable contract for API discovery: JSON-RPC discovery and
the MCP tools/list handler hand them to clients so callers know how
to invoke a method. AI/MCP clients in particular depend on explicitly
authored JSON schemas (enums, nested objects, per-property
descriptions) to make correct tool calls; the auto-generated fallback
built from the flat parameters array cannot express any of that.

ApiRegistry undermined this: when getMethodDescriptor() and
listMethods() re-wrap a provider-local descriptor to prefix the
interface name ("edit" -> "wiki.edit"), they rebuilt the descriptor
from only name, description, parameters, returnType and permissions.
Explicitly authored schemas were silently discarded, so every
discovery consumer saw degraded or empty schemas regardless of how
carefully a provider declared them.

Route both re-wrap sites through a shared prefixDescriptor() helper
that copies every field, and add a regression test covering both
getMethodDescriptor() and listMethods().
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