+330
bin/audio_example.ml
+330
bin/audio_example.ml
···+let value = int_of_float (amplitude *. max_amplitude *. sin (2.0 *. Float.pi *. frequency *. t)) in+let b2 = if i * 3 + 1 < String.length bytes then Char.code (String.get bytes (i * 3 + 1)) else 0 in+let b3 = if i * 3 + 2 < String.length bytes then Char.code (String.get bytes (i * 3 + 2)) else 0 in
+52
-41
bin/capitalize_sdk.ml
+52
-41
bin/capitalize_sdk.ml
···············
+193
bin/completion_example.ml
+193
bin/completion_example.ml
···+("rust", ["memory safety"; "performance"; "static typing"; "ownership"; "zero-cost abstractions"]);+("javascript", ["dynamic typing"; "interpreted"; "prototypes"; "single-threaded"; "event-driven"]);+content = make_text_content (Printf.sprintf "Tell me about the %s programming language" language)+content = make_text_content (Printf.sprintf "%s is a programming language with the following features: %s" language features)
+36
-2
bin/dune
+36
-2
bin/dune
···
+468
bin/image_generator_example.ml
+468
bin/image_generator_example.ml
···+let b2 = if i * 3 + 1 < String.length bytes then Char.code (String.get bytes (i * 3 + 1)) else 0 in+let b3 = if i * 3 + 2 < String.length bytes then Char.code (String.get bytes (i * 3 + 2)) else 0 in+let result = Buffer.create (8 + Buffer.length ihdr_chunk + Buffer.length idat_chunk + Buffer.length iend_chunk) in+content = make_text_content (Printf.sprintf "Please describe what you see in this %dx%d pixel art."
+502
bin/multimodal_example.ml
+502
bin/multimodal_example.ml
···+let b2 = if i * 3 + 1 < String.length bytes then Char.code (String.get bytes (i * 3 + 1)) else 0 in+let b3 = if i * 3 + 2 < String.length bytes then Char.code (String.get bytes (i * 3 + 2)) else 0 in+let value = int_of_float (amplitude *. max_amplitude *. sin (2.0 *. Float.pi *. frequency *. t)) in+content = make_text_content "I've received your multimodal message with text, image, and audio."+content = make_text_resource_content (Printf.sprintf "resource://%s" resource_id) resource_content ~mime_type:"text/plain" ()+let server = configure_server server ~with_tools:true ~with_resources:false ~with_prompts:true () in
+186
bin/resource_template_example.ml
+186
bin/resource_template_example.ml
···+Text TextContent.{ text = Printf.sprintf "Resource reference for document %s:" doc_id; annotations = None };+content = make_text_content (Printf.sprintf "Please summarize the following document (ID: %s):" doc_id)
+6
lib/dune
+6
lib/dune
+460
-1
lib/mcp.ml
+460
-1
lib/mcp.ml
······+let annotations = List.assoc_opt "annotations" fields |> Option.map Annotated.annotation_of_yojson in············
+156
-1
lib/mcp.mli
+156
-1
lib/mcp.mli
···············val create_notification : ?params:Json.t option -> method_:string -> unit -> JSONRPCMessage.tval create_request : ?params:Json.t option -> ?progress_token:ProgressToken.t option -> id:RequestId.t -> method_:string -> unit -> JSONRPCMessage.t-val create_error : id:RequestId.t -> code:int -> message:string -> ?data:Json.t option -> unit -> JSONRPCMessage.t+val create_error : id:RequestId.t -> code:int -> message:string -> ?data:Json.t option -> unit -> JSONRPCMessage.t+val create_completion_request : id:RequestId.t -> argument:Completion.Argument.t -> ref:Completion.Request.reference -> JSONRPCMessage.t+val create_completion_response : id:RequestId.t -> values:string list -> ?has_more:bool option -> ?total:int option -> ?meta:Json.t option -> unit -> JSONRPCMessage.t
+248
-194
lib/mcp_sdk.ml
+248
-194
lib/mcp_sdk.ml
···············-let create ~name ?(version="0.1.0") ?(protocol_version="2024-11-05") ?startup_hook ?shutdown_hook () =+let default_capabilities ?(with_tools=true) ?(with_resources=false) ?(with_prompts=false) () =+let add_tool server ~name ?description ?(schema_properties=[]) ?(schema_required=[]) handler =-let default_capabilities ?(with_tools=true) ?(with_resources=false) ?(with_prompts=false) () =-let capabilities = Server.default_capabilities ~with_tools ~with_resources ~with_prompts () in
+67
-40
lib/mcp_sdk.mli
+67
-40
lib/mcp_sdk.mli
···val create : name:string -> ?description:string -> ?arguments:argument list -> handler:handler -> unit -> tval create_argument : name:string -> ?description:string -> ?required:bool -> unit -> argument+val create_server : name:string -> ?version:string -> ?protocol_version:string -> unit -> server+val default_capabilities : ?with_tools:bool -> ?with_resources:bool -> ?with_prompts:bool -> unit -> Json.t+val add_tool : server -> name:string -> ?description:string -> ?schema_properties:(string * string * string) list -> ?schema_required:string list -> (Json.t -> Json.t) -> Tool.t+val add_resource : server -> uri_template:string -> ?description:string -> ?mime_type:string -> (string list -> string) -> Resource.t+val add_prompt : server -> name:string -> ?description:string -> ?arguments:(string * string option * bool) list -> ((string * string) list -> Prompt.message list) -> Prompt.t+val configure_server : server -> ?with_tools:bool -> ?with_resources:bool -> ?with_prompts:bool -> unit -> server-val create : name:string -> ?version:string -> ?protocol_version:string -> ?startup_hook:startup_hook -> ?shutdown_hook:shutdown_hook -> unit -> t-val default_capabilities : ?with_tools:bool -> ?with_resources:bool -> ?with_prompts:bool -> unit -> Json.t-val tool : ?name:string option -> ?description:string -> ?schema_properties:(string * string * string) list -> ?schema_required:string list -> (Json.t -> Json.t) -> Tool.t-val resource : ?uri_template:string option -> ?description:string -> ?mime_type:string -> (string list -> string) -> Resource.t-val prompt : ?name:string option -> ?description:string -> ?arguments:(string * string option * bool) list -> ((string * string) list -> Prompt.message list) -> Prompt.t
+533
lib/mcp_server.ml
+533
lib/mcp_server.ml
···+Some (create_error ~id:req.id ~code:ErrorCode.invalid_params ~message:"Invalid params for tools/call" ())+Some (create_error ~id:req.id ~code:ErrorCode.method_not_found ~message:"Resources not supported" ())+Some (create_error ~id:req.id ~code:ErrorCode.method_not_found ~message:"Prompts not supported" ())+Some (create_error ~id:req.id ~code:ErrorCode.invalid_params ~message:(Printf.sprintf "Prompt not found: %s" name) ())+Some (create_error ~id:req.id ~code:ErrorCode.invalid_params ~message:"Invalid params format" ())+Some (create_error ~id:req.id ~code:ErrorCode.method_not_found ~message:"Prompts not supported" ())+Some (create_error ~id:req.id ~code:ErrorCode.method_not_found ~message:("Method not found: " ^ req.method_) ())+Log.error (Printf.sprintf "Exception during message processing: %s" (Printexc.to_string exc));+Log.debug (Printf.sprintf "Raw input: %s" (String.sub line 0 (min 100 (String.length line))));+Log.error (Printf.sprintf "Input was: %s" (String.sub line 0 (min 100 (String.length line))));+let error_resp = create_error ~id ~code:ErrorCode.internal_error ~message:(Printexc.to_string exc) () in
+54
lib/mcp_server.mli
+54
lib/mcp_server.mli
···
+178
spec/00-arch.md
+178
spec/00-arch.md
···
+4
spec/README.md
+4
spec/README.md
+239
spec/lifecycle.md
+239
spec/lifecycle.md
···+| -------- | -------------- | -------------------------------------------------------------------------- |+| Client | `sampling` | Support for LLM [sampling]({{< ref "../client/sampling" >}}) requests |+| Server | `logging` | Emits structured [log messages]({{< ref "../server/utilities/logging" >}}) |
+265
spec/prompts.md
+265
spec/prompts.md
···
+357
spec/resources.md
+357
spec/resources.md
···+[XDG MIME type](https://specifications.freedesktop.org/shared-mime-info-spec/0.14/ar01s02.html#id-1.3.14),
spec/slash-command.png
spec/slash-command.png
This is a binary file and will not be displayed.
+299
spec/tools.md
+299
spec/tools.md
···
+278
spec/transports.md
+278
spec/transports.md
···+[SSE standard](https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation).+[`Last-Event-ID`](https://html.spec.whatwg.org/multipage/server-sent-events.html#the-last-event-id-header)