My agentic slop goes here. Not intended for anyone else!
1(** MCP Content Block types.
2
3 Content blocks are the building blocks for tool results, prompts, and resource contents.
4 They support text, images, audio, embedded resources, and tool use/results. *)
5
6(** {1 Annotations} *)
7
8module Audience : sig
9 type t = User | Assistant
10 (** Who should see this content *)
11
12 val jsont : t Jsont.t
13 val pp : Format.formatter -> t -> unit
14end
15
16module Annotations : sig
17 type t = {
18 audience : Audience.t list option;
19 priority : float option;
20 unknown : Jsont.json;
21 }
22 (** Hints about content visibility and importance *)
23
24 val empty : t
25 val jsont : t Jsont.t
26 val pp : Format.formatter -> t -> unit
27end
28
29(** {1 Text Content} *)
30
31module Text : sig
32 type t = {
33 text : string;
34 annotations : Annotations.t option;
35 unknown : Jsont.json;
36 }
37 (** Plain text content *)
38
39 val make : string -> t
40 val jsont : t Jsont.t
41 val pp : Format.formatter -> t -> unit
42end
43
44(** {1 Image Content} *)
45
46module Image : sig
47 type t = {
48 data : string; (** Base64-encoded image data *)
49 mime_type : string; (** e.g. "image/png" *)
50 annotations : Annotations.t option;
51 unknown : Jsont.json;
52 }
53 (** Image content (base64-encoded) *)
54
55 val make : data:string -> mime_type:string -> t
56 val jsont : t Jsont.t
57 val pp : Format.formatter -> t -> unit
58end
59
60(** {1 Audio Content} *)
61
62module Audio : sig
63 type t = {
64 data : string; (** Base64-encoded audio data *)
65 mime_type : string; (** e.g. "audio/mp3" *)
66 annotations : Annotations.t option;
67 unknown : Jsont.json;
68 }
69 (** Audio content (base64-encoded) *)
70
71 val make : data:string -> mime_type:string -> t
72 val jsont : t Jsont.t
73 val pp : Format.formatter -> t -> unit
74end
75
76(** {1 Embedded Resource} *)
77
78module Embedded_resource : sig
79 type resource = {
80 uri : string;
81 mime_type : string option;
82 text : string option;
83 blob : string option; (** Base64-encoded binary data *)
84 unknown : Jsont.json;
85 }
86 (** Resource contents *)
87
88 type t = {
89 resource : resource;
90 annotations : Annotations.t option;
91 unknown : Jsont.json;
92 }
93 (** Embedded resource content *)
94
95 val make_text : uri:string -> text:string -> ?mime_type:string -> unit -> t
96 val make_blob : uri:string -> blob:string -> mime_type:string -> t
97 val jsont : t Jsont.t
98 val pp : Format.formatter -> t -> unit
99end
100
101(** {1 Content Block} *)
102
103type block =
104 | Text of Text.t
105 | Image of Image.t
106 | Audio of Audio.t
107 | Embedded_resource of Embedded_resource.t
108(** Content block variants *)
109
110val block_jsont : block Jsont.t
111(** Codec for content blocks (discriminated by "type" field) *)
112
113val pp_block : Format.formatter -> block -> unit
114(** Pretty-print a content block *)
115
116(** {1 Convenience Constructors} *)
117
118val text : string -> block
119(** Create a text content block *)
120
121val image : data:string -> mime_type:string -> block
122(** Create an image content block *)
123
124val audio : data:string -> mime_type:string -> block
125(** Create an audio content block *)