Allow params field to be omitted in requests for methods that don't require them (#17)
* Allow `params` field to be omitted in requests for methods with empty parameters * Add ping request to roundtrip test * Generalize decoding of non-required parameters
This commit is contained in:
parent
3e628db6d8
commit
6f1f65a392
3 changed files with 206 additions and 25 deletions
|
|
@ -153,10 +153,14 @@ public struct Prompt: Hashable, Codable, Sendable {
|
|||
public enum ListPrompts: Method {
|
||||
public static let name: String = "prompts/list"
|
||||
|
||||
public struct Parameters: Hashable, Codable, Sendable {
|
||||
public struct Parameters: NotRequired, Hashable, Codable, Sendable {
|
||||
public let cursor: String?
|
||||
|
||||
public init() {
|
||||
self.cursor = nil
|
||||
}
|
||||
|
||||
public init(cursor: String? = nil) {
|
||||
public init(cursor: String) {
|
||||
self.cursor = cursor
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,10 +99,14 @@ public struct Resource: Hashable, Codable, Sendable {
|
|||
public enum ListResources: Method {
|
||||
public static let name: String = "resources/list"
|
||||
|
||||
public struct Parameters: Hashable, Codable, Sendable {
|
||||
public struct Parameters: NotRequired, Hashable, Codable, Sendable {
|
||||
public let cursor: String?
|
||||
|
||||
public init(cursor: String? = nil) {
|
||||
public init() {
|
||||
self.cursor = nil
|
||||
}
|
||||
|
||||
public init(cursor: String) {
|
||||
self.cursor = cursor
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,10 +118,14 @@ public struct Tool: Hashable, Codable, Sendable {
|
|||
public enum ListTools: Method {
|
||||
public static let name = "tools/list"
|
||||
|
||||
public struct Parameters: Hashable, Codable, Sendable {
|
||||
public struct Parameters: NotRequired, Hashable, Codable, Sendable {
|
||||
public let cursor: String?
|
||||
|
||||
public init() {
|
||||
self.cursor = nil
|
||||
}
|
||||
|
||||
public init(cursor: String? = nil) {
|
||||
public init(cursor: String) {
|
||||
self.cursor = cursor
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue