-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
[Priority] HighEssential focuses for workEssential focuses for work[Type] EnhancementNew feature or requestNew feature or request
Description
The Abilities API supports both object-based and flattened (simple type) schemas for inputs and outputs. However, MCP requires input_schema.type to always be "object".
This means the MCP adapter needs to transform flattened schemas into object structures when converting Abilities to MCP tools.
Context
Related PR: WordPress/abilities-api#61 (review)
Current Behavior
The Abilities API allows schemas like:
'input_schema' => [
'type' => 'string',
'description' => 'Post type to count'
]Required Behavior
The MCP adapter must transform these into:
{
"type": "object",
"properties": {
"input": {
"type": "string",
"description": "Post type to count"
}
}
}Implementation Notes
- Property naming: Based on discussion with @gziolo, use
"input"for input schemas and"output"for output schemas - When to transform: Apply transformation when
type !== "object" - Description: Copy the description from the original schema to the wrapper property if available
- Arrays: This should also handle
type: "array"cases
Additional Considerations
- Document this transformation behavior for future adapter implementations
- Consider adding tests for various simple types (string, number, boolean, array)
- Ensure the transformation preserves all schema properties (enum, format, etc.)
Acceptance Criteria
- Adapter successfully transforms flattened input schemas to MCP-compatible object format
- Adapter successfully transforms flattened output schemas to MCP-compatible object format
- Tests cover string, number, boolean, and array types
- Documentation updated to explain the transformation
- Existing object-based schemas continue to work without modification
gziolo
Metadata
Metadata
Assignees
Labels
[Priority] HighEssential focuses for workEssential focuses for work[Type] EnhancementNew feature or requestNew feature or request
Type
Projects
Status
No status