You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
feat: Tool output schema support in db and service layer (IBM#1263)
* feat: Add outputSchema field support to tools
- Add output_schema column to Tool database model (db.py)
- Add output_schema field to Tool Pydantic model (models.py)
- Add output_schema field to ToolCreate, ToolUpdate, and ToolRead schemas
- Support both 'output_schema' and 'outputSchema' (camelCase) via alias
- Create database migration to add output_schema column to tools table
- Field is optional (nullable) to maintain backward compatibility
This resolves the issue where outputSchema was documented but not
actually stored or returned when listing/describing tools to clients.
Signed-off-by: Matt Sanchez <mattsanchez@ibm.com>
* feat(output-schema): add default output_schema and improve field handling
- Add default empty object schema for output_schema in ToolCreate
(previously None, now {"type": "object", "properties": {}})
- Pass output_schema through gateway_service and tool_service
- Add output_schema update support in tool update operations
- Refactor alembic migration: organize imports and use double quotes
for consistency
This ensures output_schema is properly initialized and can be updated
across all tool operations, improving schema validation capabilities.
* Code Review and test fix
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
---------
Signed-off-by: Matt Sanchez <mattsanchez@ibm.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Matt Sanchez <mattsanchez@ibm.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
Copy file name to clipboardExpand all lines: mcpgateway/schemas.py
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -389,6 +389,7 @@ class ToolCreate(BaseModel):
389
389
request_type (Literal["GET", "POST", "PUT", "DELETE", "PATCH"]): HTTP method to be used for invoking the tool.
390
390
headers (Optional[Dict[str, str]]): Additional headers to send when invoking the tool.
391
391
input_schema (Optional[Dict[str, Any]]): JSON Schema for validating tool parameters. Alias 'inputSchema'.
392
+
output_schema (Optional[Dict[str, Any]]): JSON Schema for validating tool output. Alias 'outputSchema'.
392
393
annotations (Optional[Dict[str, Any]]): Tool annotations for behavior hints such as title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint.
auth (Optional[AuthenticationValues]): Authentication credentials (Basic or Bearer Token or custom headers) if required.
@@ -406,6 +407,7 @@ class ToolCreate(BaseModel):
406
407
request_type: Literal["GET", "POST", "PUT", "DELETE", "PATCH", "SSE", "STDIO", "STREAMABLEHTTP"] =Field("SSE", description="HTTP method to be used for invoking the tool")
407
408
headers: Optional[Dict[str, str]] =Field(None, description="Additional headers to send when invoking the tool")
0 commit comments