Model Context Protocol in OCaml

fix

Changed files
+16 -56
lib
+16 -56
lib/mcp.mli
···
(** Roles for conversation participants *)
module Role : sig
type t = [ `User | `Assistant ]
-
-
val to_string : t -> string
-
val of_string : string -> t
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Progress tokens for long-running operations *)
module ProgressToken : sig
type t = [ `String of string | `Int of int ]
-
include Json.Jsonable.S with type t := t
end
(** Request IDs *)
module RequestId : sig
type t = [ `String of string | `Int of int ]
-
include Json.Jsonable.S with type t := t
end
(** Cursors for pagination *)
module Cursor : sig
type t = string
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Annotations for objects *)
···
audience: Role.t list option;
priority: float option;
}
-
-
val yojson_of_annotation : annotation -> Json.t
-
val annotation_of_yojson : Json.t -> annotation
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Text content *)
···
text: string;
annotations: Annotated.annotation option;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Image content *)
···
mime_type: string;
annotations: Annotated.annotation option;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Audio content *)
···
mime_type: string;
annotations: Annotated.annotation option;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Base resource contents *)
···
uri: string;
mime_type: string option;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Text resource contents *)
···
text: string;
mime_type: string option;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Binary resource contents *)
···
blob: string;
mime_type: string option;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Embedded resource *)
···
resource: [ `Text of TextResourceContents.t | `Blob of BlobResourceContents.t ];
annotations: Annotated.annotation option;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Content type used in messages *)
···
role: Role.t;
content: content;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Message for sampling *)
···
role: Role.t;
content: [ `Text of TextContent.t | `Image of ImageContent.t | `Audio of AudioContent.t ];
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** Implementation information *)
···
name: string;
version: string;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
end
(** JSONRPC message types *)
···
client_info: Implementation.t;
protocol_version: string;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
val create : capabilities:Json.t -> client_info:Implementation.t -> protocol_version:string -> t
val to_jsonrpc : id:RequestId.t -> t -> JSONRPCMessage.t
···
instructions: string option;
meta: Json.t option;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
val create : capabilities:Json.t -> server_info:Implementation.t -> protocol_version:string -> ?instructions:string -> ?meta:Json.t -> unit -> t
val to_jsonrpc : id:RequestId.t -> t -> JSONRPCMessage.t
···
type t = {
meta: Json.t option;
}
-
-
val yojson_of_t : t -> Json.t
-
val t_of_yojson : Json.t -> t
+
include Json.Jsonable.S with type t := t
val create : ?meta:Json.t -> unit -> t
val to_jsonrpc : t -> JSONRPCMessage.t