+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
+41
-7
bin/capitalize_sdk.ml
+41
-7
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)
+37
-4
bin/dune
+37
-4
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
-341
bin/multimodal_sdk.ml
-341
bin/multimodal_sdk.ml
···-"<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" rx=\"%d\" fill=\"%s\" fill-opacity=\"%.2f\" />\n"
+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)
+365
bin/server.ml
+365
bin/server.ml
···+log_debug (Printf.sprintf "Client info: %s v%s" req.client_info.name req.client_info.version);+log_debug (Printf.sprintf "Protocol version mismatch: client=%s server=%s - will use server version"+Some (create_error ~id:req.id ~code:(-32601) ~message:("Method not found: " ^ req.method_) ()))+log_error (Printf.sprintf "Exception during message processing: %s" (Printexc.to_string exc));
+5
bin/server.mli
+5
bin/server.mli
···
+2
-2
lib/dune
+2
-2
lib/dune
+422
-6
lib/mcp.ml
+422
-6
lib/mcp.ml
···························
+144
-2
lib/mcp.mli
+144
-2
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
+93
-125
lib/mcp_sdk.ml
+93
-125
lib/mcp_sdk.ml
···············-let create_rich_tool_result ?(text=None) ?(image=None) ?(audio=None) ?(resource=None) ~is_error () =let add_tool server ~name ?description ?(schema_properties=[]) ?(schema_required=[]) handler =···
+34
-42
lib/mcp_sdk.mli
+34
-42
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 -> argumentval create_server : name:string -> ?version:string -> ?protocol_version:string -> unit -> server···val configure_server : server -> ?with_tools:bool -> ?with_resources:bool -> ?with_prompts:bool -> unit -> server
+512
-267
lib/mcp_server.ml
+512
-267
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.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)