Skip to content
Merged
Show file tree
Hide file tree
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: 10 additions & 10 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ let package = Package(
.executable(name: "occtmcp-server", targets: ["OCCTMCPServer"]),
],
dependencies: [
// Temporary pin against gsdali's swift-sdk fork while
// modelcontextprotocol/swift-sdk#226 is in review. Upstream
// tag floor goes back to `from: "0.11.0"` once the PR merges.
// The branch ships `Value.numberValue` (proposed in upstream
// #225) — Server.swift consumes it directly so we delete our
// own back-port the moment upstream lands.
.package(url: "https://github.com/gsdali/swift-sdk.git", branch: "add-value-numbervalue"),
// Official MCP Swift SDK. `Value.numberValue` (proposed upstream
// in modelcontextprotocol/swift-sdk#225, PR #226) is not yet in a
// tagged release, so we back-port it locally in
// Sources/OCCTMCPCore/Value+NumberValue.swift. Delete that file
// and nothing else changes once the SDK ships the property.
.package(url: "https://github.com/modelcontextprotocol/swift-sdk.git", from: "0.11.0"),
// OCCT 8.0.0 GA cohort.
//
// OCCTSwift 1.1.0 closes gsdali/OCCTSwift#167: TopologyGraph
Expand Down
24 changes: 24 additions & 0 deletions Sources/OCCTMCPCore/Value+NumberValue.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import MCP

extension Value {
/// Back-port of the upstream `Value.numberValue` proposed in
/// modelcontextprotocol/swift-sdk#225 (PR #226), pending a tagged
/// release of the official SDK.
///
/// JSON has a single `number` type with no integer/float distinction,
/// and `Value.init(from:)` tries `Int` first — so `Value.double(0)`
/// round-trips through JSON to `Value.int(0)` and `doubleValue` returns
/// `nil`. This accessor coerces both `.int` and `.double` to `Double`,
/// which is what tool-argument readers want for coordinates, dimensions,
/// tolerances, and angles. Returns `nil` for any non-numeric case.
///
/// Remove this file once the SDK ships `numberValue` upstream; no other
/// code changes are required.
var numberValue: Double? {
switch self {
case .int(let value): return Double(value)
case .double(let value): return value
default: return nil
}
}
}