Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions MCPServer/Sources/Convenience/Schemable+extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,23 @@ extension JSONSchema_JSONValue {
}
}
}

/*
'Input.schema.schemaValue.json' would not be compiled because Input.schema.schemaValue returns a SchemaValue object, but there was no direct way to convert this to the custom JSON type. The existing extensions only handled:
[KeywordIdentifier: JSONSchema_JSONValue] → JSON
JSONSchema_JSONValue → JSON.Value
But there was no extension for:
SchemaValue → JSON
*/
extension SchemaValue {
var json: JSON {
switch self {
case .boolean(let value):
// For boolean schema values, create a simple JSON object
return .object(["type": .string("boolean"), "default": .bool(value)])
case .object(let dict):
// Use the existing extension on [KeywordIdentifier: JSONSchema_JSONValue]
return dict.json
}
}
}
Loading