fix(core): preserve descriptor schemas in ApiRegistry re-wrapping#199
Open
TDannhauer wants to merge 1 commit into
Open
fix(core): preserve descriptor schemas in ApiRegistry re-wrapping#199TDannhauer wants to merge 1 commit into
TDannhauer wants to merge 1 commit into
Conversation
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().
cc90766 to
36032b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ApiRegistry::getMethodDescriptor()and::listMethods()re-wrap providerdescriptors to prefix the interface name (
wiki.edit), but dropped theinputSchema/outputSchemafields in the process.Motivation
MethodDescriptor::$inputSchema/$outputSchemaare the machine-readablecontract for API discovery: JSON-RPC discovery (
rpc.discover) and the MCPtools/listhandler pass them to clients so callers know how to invoke amethod. 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
parametersarray cannot expressany of that.
Because the
ApiRegistryre-wrap silently discarded these fields, everydiscovery 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/rpcis blocked until descriptors survive aggregationintact, which is how the bug was found.
Changes
prefixDescriptor()helper that preserves all
MethodDescriptorfields.testDescriptorSchemasPreservedcoveringgetMethodDescriptor()andlistMethods().Test plan
test/Unit/Api/suite passes (20 tests, 35 assertions)