Model Context Protocol in OCaml

Fix binary builds after MCP message module renaming

- Update ocaml_eval_sdk.ml to use Mcp_rpc instead of Mcp_message
- Fix Tool.create_tool_result references in binary modules

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

+9 -9
bin/multimodal_sdk.ml
···
let audio_data = generate_sine_wave_audio (float_of_int frequency) duration in
(* Create a multimodal tool result *)
-
create_tool_result [
+
Tool.create_tool_result [
Mcp.make_text_content message;
Mcp.make_image_content image_data "image/gif";
Mcp.make_audio_content audio_data "audio/wav"
···
with
| Failure msg ->
Log.error (Printf.sprintf "Error in multimodal tool: %s" msg);
-
create_tool_result [Mcp.make_text_content (Printf.sprintf "Error: %s" msg)] ~is_error:true
+
Tool.create_tool_result [Mcp.make_text_content (Printf.sprintf "Error: %s" msg)] ~is_error:true
)
(* Define and register a tool for generating only images *)
···
let height = get_int_param args "height" in
if width < 1 || width > 1024 || height < 1 || height > 1024 then
-
create_tool_result
+
Tool.create_tool_result
[Mcp.make_text_content "Error: Dimensions must be between 1 and 1024 pixels"]
~is_error:true
else
let image_data = generate_random_image width height in
-
create_tool_result
+
Tool.create_tool_result
[Mcp.make_image_content image_data "image/gif"]
~is_error:false
with
| Failure msg ->
Log.error (Printf.sprintf "Error in generate_image tool: %s" msg);
-
create_tool_result [Mcp.make_text_content (Printf.sprintf "Error: %s" msg)] ~is_error:true
+
Tool.create_tool_result [Mcp.make_text_content (Printf.sprintf "Error: %s" msg)] ~is_error:true
)
(* Define and register a tool for generating only audio *)
···
let duration = get_int_param args "duration" in
if frequency < 20 || frequency > 20000 then
-
create_tool_result
+
Tool.create_tool_result
[Mcp.make_text_content "Error: Frequency must be between 20Hz and 20,000Hz"]
~is_error:true
else if duration < 1 || duration > 10 then
-
create_tool_result
+
Tool.create_tool_result
[Mcp.make_text_content "Error: Duration must be between 1 and 10 seconds"]
~is_error:true
else
let audio_data = generate_sine_wave_audio (float_of_int frequency) duration in
-
create_tool_result
+
Tool.create_tool_result
[Mcp.make_audio_content audio_data "audio/wav"]
~is_error:false
with
| Failure msg ->
Log.error (Printf.sprintf "Error in generate_audio tool: %s" msg);
-
create_tool_result [Mcp.make_text_content (Printf.sprintf "Error: %s" msg)] ~is_error:true
+
Tool.create_tool_result [Mcp.make_text_content (Printf.sprintf "Error: %s" msg)] ~is_error:true
)
(* Define and register a resource example with multimodal content *)
+3 -3
bin/ocaml_eval_sdk.ml
···
open Mcp_sdk
-
open Mcp_message
+
open Mcp_rpc
(* Set up the formatter for capturing evaluation output *)
let capture_output f =
···
in
(* Create a tool result with colorized output *)
-
create_tool_result [
+
Tool.create_tool_result [
Mcp.make_text_content output
] ~is_error:(not success)
with
| Failure msg ->
Log.error (Printf.sprintf "Error in OCaml eval tool: %s" msg);
-
create_tool_result [Mcp.make_text_content (Printf.sprintf "Error: %s" msg)] ~is_error:true
+
Tool.create_tool_result [Mcp.make_text_content (Printf.sprintf "Error: %s" msg)] ~is_error:true
)
(* Run the server with the default scheduler *)
lib/mcp_message.ml lib/mcp_rpc.ml
lib/mcp_message.mli lib/mcp_rpc.mli