-module(mcp_toolkit@core@protocol). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/mcp_toolkit/core/protocol.gleam"). -export([client_capabilities_sampling_decoder/0, client_capabilities_sampling_to_json/1, complete_request_argument_decoder/0, complete_request_argument_to_json/1, content_type_decoder/0, content_type_to_json/1, include_context_decoder/0, include_context_to_json/1, implementation_decoder/0, implementation_to_json/1, progress_token_decoder/0, progress_token_to_json/1, logging_level_decoder/0, logging_level_to_json/1, ping_result_decoder/0, ping_result_to_json/1, prompt_reference_decoder/0, prompt_reference_to_json/1, read_resource_request_decoder/0, read_resource_request_to_json/1, resource_reference_decoder/0, complete_request_reference_decoder/0, complete_request_decoder/0, resource_reference_to_json/1, complete_request_reference_to_json/1, complete_request_to_json/1, resource_updated_notification_decoder/0, resource_updated_notification_to_json/1, role_decoder/0, role_to_json/1, server_capabilities_completions_decoder/0, server_capabilities_completions_to_json/1, server_capabilities_logging_decoder/0, server_capabilities_logging_to_json/1, set_level_request_decoder/0, set_level_request_to_json/1, subscribe_request_decoder/0, subscribe_request_to_json/1, tool_input_schema_decoder/0, tool_input_schema/1, tool_input_schema_to_json/1, unsubscribe_request_decoder/0, unsubscribe_request_to_json/1, omittable_field/3, annotations_decoder/0, audio_content_decoder/0, blob_resource_contents_decoder/0, call_tool_request_decoder/1, meta_decoder/0, cancelled_notification_decoder/0, client_capabilities_roots_decoder/0, client_capabilities_decoder/0, completion_decoder/0, complete_result_decoder/0, get_prompt_request_decoder/0, image_content_decoder/0, initialize_request_decoder/0, initialized_notification_decoder/0, list_request_decoder/0, list_roots_request_decoder/0, logging_message_notification_decoder/1, model_hint_decoder/0, model_preferences_decoder/0, ping_request_decoder/0, progress_notification_decoder/0, prompt_argument_decoder/0, prompt_decoder/0, list_prompts_result_decoder/0, prompt_list_changed_notification_decoder/0, resource_decoder/0, list_resources_result_decoder/0, resource_list_changed_notification_decoder/0, resource_template_decoder/0, list_resource_templates_result_decoder/0, root_decoder/0, list_roots_result_decoder/0, roots_list_changed_notification_decoder/0, server_capabilities_prompts_decoder/0, server_capabilities_resources_decoder/0, server_capabilities_tools_decoder/0, initialize_result_decoder/0, text_content_decoder/0, message_content_decoder/0, create_message_result_decoder/0, sampling_message_decoder/0, create_message_request_decoder/1, text_resource_contents_decoder/0, resource_contents_decoder/0, embedded_resource_decoder/0, tool_result_content_decoder/0, call_tool_result_decoder/0, prompt_message_content_decoder/0, prompt_message_decoder/0, get_prompt_result_decoder/0, read_resource_result_decoder/0, tool_annotations_decoder/0, tool_decoder/0, list_tools_result_decoder/0, tool_list_changed_notification_decoder/0, omittable_to_json/4, annotations_to_json/1, audio_content_to_json/1, blob_resource_contents_to_json/1, call_tool_request_to_json/2, meta_to_json/1, cancelled_notification_to_json/1, client_capabilities_roots_to_json/1, client_capabilities_to_json/1, completion_to_json/1, complete_result_to_json/1, get_prompt_request_to_json/1, image_content_to_json/1, initialize_request_to_json/1, initialized_notification_to_json/1, list_request_to_json/1, list_roots_request_to_json/1, logging_message_notification_to_json/2, model_hint_to_json/1, model_preferences_to_json/1, ping_request_to_json/1, progress_notification_to_json/1, prompt_argument_to_json/1, prompt_to_json/1, list_prompts_result_to_json/1, prompt_list_changed_notification_to_json/1, resource_to_json/1, list_resources_result_to_json/1, resource_list_changed_notification_to_json/1, resource_template_to_json/1, list_resource_templates_result_to_json/1, root_to_json/1, encode_list_roots_result/1, roots_list_changed_notification_to_json/1, server_capabilities_prompts_to_json/1, server_capabilities_resources_to_json/1, server_capabilities_tools_to_json/1, server_capabilities_to_json/1, initialize_result_to_json/1, text_content_to_json/1, message_content_to_json/1, create_message_result_to_json/1, sampling_message_to_json/1, create_message_request_to_json/2, text_resource_contents_to_json/1, resource_contents_to_json/1, embedded_resource_to_json/1, tool_result_content_to_json/1, call_tool_result_to_json/1, prompt_message_content_to_json/1, prompt_message_to_json/1, get_prompt_result_to_json/1, read_resource_result_to_json/1, tool_annotations_to_json/1, tool_to_json/1, list_tools_result_to_json/1, tool_list_changed_notification_to_json/1]). -export_type([mcp_error/0, annotations/0, audio_content/0, blob_resource_contents/0, call_tool_request/1, tool_result_content/0, call_tool_result/0, meta/0, cancelled_notification/0, client_capabilities/0, client_capabilities_roots/0, client_capabilities_sampling/0, complete_request/0, complete_request_argument/0, complete_request_reference/0, complete_result/0, completion/0, content_type/0, create_message_request/1, include_context/0, create_message_result/0, message_content/0, embedded_resource/0, resource_contents/0, get_prompt_request/0, get_prompt_result/0, image_content/0, implementation/0, initialize_request/0, initialize_result/0, initialized_notification/0, progress_token/0, list_request/0, list_prompts_result/0, list_resource_templates_result/0, list_resources_result/0, list_roots_request/0, list_roots_result/0, list_tools_result/0, logging_level/0, logging_message_notification/1, model_hint/0, model_preferences/0, ping_request/0, ping_result/0, progress_notification/0, prompt/0, prompt_argument/0, prompt_list_changed_notification/0, prompt_message/0, prompt_message_content/0, prompt_reference/0, read_resource_request/0, read_resource_result/0, resource/0, resource_list_changed_notification/0, resource_reference/0, resource_template/0, resource_updated_notification/0, role/0, root/0, roots_list_changed_notification/0, sampling_message/0, server_capabilities/0, server_capabilities_completions/0, server_capabilities_logging/0, server_capabilities_prompts/0, server_capabilities_resources/0, server_capabilities_tools/0, set_level_request/0, subscribe_request/0, text_content/0, text_resource_contents/0, tool/0, tool_annotations/0, tool_input_schema/0, tool_list_changed_notification/0, unsubscribe_request/0]). -type mcp_error() :: parse_error | invalid_request | method_not_found | invalid_params | internal_error | {application_error, binary()}. -type annotations() :: {annotations, gleam@option:option(list(role())), gleam@option:option(float())}. -type audio_content() :: {audio_content, gleam@option:option(annotations()), binary(), binary(), content_type()}. -type blob_resource_contents() :: {blob_resource_contents, binary(), gleam@option:option(binary()), binary()}. -type call_tool_request(WVP) :: {call_tool_request, binary(), gleam@option:option(WVP)}. -type tool_result_content() :: {text_tool_content, text_content()} | {image_tool_content, image_content()} | {audio_tool_content, audio_content()} | {resource_tool_content, embedded_resource()}. -type call_tool_result() :: {call_tool_result, gleam@option:option(meta()), list(tool_result_content()), gleam@option:option(boolean())}. -type meta() :: {meta, gleam@option:option(progress_token())}. -type cancelled_notification() :: {cancelled_notification, gleam@option:option(binary()), jsonrpcx:id()}. -type client_capabilities() :: {client_capabilities, gleam@option:option(client_capabilities_roots()), gleam@option:option(client_capabilities_sampling())}. -type client_capabilities_roots() :: {client_capabilities_roots, gleam@option:option(boolean())}. -type client_capabilities_sampling() :: client_capabilities_sampling. -type complete_request() :: {complete_request, complete_request_argument(), complete_request_reference()}. -type complete_request_argument() :: {complete_request_argument, binary(), binary()}. -type complete_request_reference() :: {complete_request_prompt_reference, prompt_reference()} | {complete_request_resource_reference, resource_reference()}. -type complete_result() :: {complete_result, gleam@option:option(meta()), completion()}. -type completion() :: {completion, gleam@option:option(boolean()), gleam@option:option(integer()), list(binary())}. -type content_type() :: content_type_text | content_type_image | content_type_audio | content_type_resource. -type create_message_request(WVQ) :: {create_message_request, gleam@option:option(include_context()), integer(), list(sampling_message()), gleam@option:option(WVQ), gleam@option:option(model_preferences()), gleam@option:option(list(binary())), gleam@option:option(binary()), gleam@option:option(integer())}. -type include_context() :: all_servers | none | this_server. -type create_message_result() :: {create_message_result, gleam@option:option(meta()), message_content(), binary(), role(), gleam@option:option(binary())}. -type message_content() :: {text_message_content, text_content()} | {image_message_content, image_content()} | {audio_message_content, audio_content()}. -type embedded_resource() :: {embedded_resource, gleam@option:option(annotations()), resource_contents(), binary()}. -type resource_contents() :: {text_resource, text_resource_contents()} | {blob_resource, blob_resource_contents()}. -type get_prompt_request() :: {get_prompt_request, gleam@option:option(gleam@dict:dict(binary(), binary())), binary()}. -type get_prompt_result() :: {get_prompt_result, gleam@option:option(meta()), gleam@option:option(binary()), list(prompt_message())}. -type image_content() :: {image_content, gleam@option:option(annotations()), binary(), binary(), binary()}. -type implementation() :: {implementation, binary(), binary()}. -type initialize_request() :: {initialize_request, client_capabilities(), implementation(), binary()}. -type initialize_result() :: {initialize_result, gleam@option:option(meta()), server_capabilities(), gleam@option:option(binary()), binary(), implementation()}. -type initialized_notification() :: {initialized_notification, gleam@option:option(meta())}. -type progress_token() :: {progress_token_string, binary()} | {progress_token_int, integer()}. -type list_request() :: {list_request, gleam@option:option(binary())}. -type list_prompts_result() :: {list_prompts_result, gleam@option:option(meta()), gleam@option:option(binary()), list(prompt())}. -type list_resource_templates_result() :: {list_resource_templates_result, gleam@option:option(meta()), gleam@option:option(binary()), list(resource_template())}. -type list_resources_result() :: {list_resources_result, gleam@option:option(meta()), gleam@option:option(binary()), list(resource())}. -type list_roots_request() :: {list_roots_request_params, gleam@option:option(meta())}. -type list_roots_result() :: {list_roots_result, gleam@option:option(meta()), list(root())}. -type list_tools_result() :: {list_tools_result, gleam@option:option(meta()), gleam@option:option(binary()), list(tool())}. -type logging_level() :: alert | critical | debug | emergency | error | info | notice | warning. -type logging_message_notification(WVR) :: {logging_message_notification, WVR, logging_level(), gleam@option:option(binary())}. -type model_hint() :: {model_hint, gleam@option:option(binary())}. -type model_preferences() :: {model_preferences, gleam@option:option(integer()), gleam@option:option(list(model_hint())), gleam@option:option(integer()), gleam@option:option(integer())}. -type ping_request() :: {ping_request, gleam@option:option(meta())}. -type ping_result() :: ping_result. -type progress_notification() :: {progress_notification, gleam@option:option(binary()), integer(), progress_token(), gleam@option:option(integer())}. -type prompt() :: {prompt, gleam@option:option(list(prompt_argument())), gleam@option:option(binary()), binary()}. -type prompt_argument() :: {prompt_argument, gleam@option:option(binary()), binary(), gleam@option:option(boolean())}. -type prompt_list_changed_notification() :: {prompt_list_changed_notification, gleam@option:option(meta())}. -type prompt_message() :: {prompt_message, prompt_message_content(), role()}. -type prompt_message_content() :: {text_prompt_content, text_content()} | {image_prompt_content, image_content()} | {audio_prompt_content, audio_content()} | {resource_prompt_content, embedded_resource()}. -type prompt_reference() :: {prompt_reference, binary(), binary()}. -type read_resource_request() :: {read_resource_request, binary()}. -type read_resource_result() :: {read_resource_result, gleam@option:option(meta()), list(resource_contents())}. -type resource() :: {resource, gleam@option:option(annotations()), gleam@option:option(binary()), gleam@option:option(binary()), binary(), gleam@option:option(integer()), binary()}. -type resource_list_changed_notification() :: {resource_list_changed_notification, gleam@option:option(meta())}. -type resource_reference() :: {resource_reference, binary(), binary()}. -type resource_template() :: {resource_template, gleam@option:option(annotations()), gleam@option:option(binary()), gleam@option:option(binary()), binary(), binary()}. -type resource_updated_notification() :: {resource_updated_notification, binary()}. -type role() :: assistant | user. -type root() :: {root, gleam@option:option(binary()), binary()}. -type roots_list_changed_notification() :: {roots_list_changed_notification, gleam@option:option(meta())}. -type sampling_message() :: {sampling_message, message_content(), role()}. -type server_capabilities() :: {server_capabilities, gleam@option:option(server_capabilities_completions()), gleam@option:option(server_capabilities_logging()), gleam@option:option(server_capabilities_prompts()), gleam@option:option(server_capabilities_resources()), gleam@option:option(server_capabilities_tools())}. -type server_capabilities_completions() :: server_capabilities_completions. -type server_capabilities_logging() :: server_capabilities_logging. -type server_capabilities_prompts() :: {server_capabilities_prompts, gleam@option:option(boolean())}. -type server_capabilities_resources() :: {server_capabilities_resources, gleam@option:option(boolean()), gleam@option:option(boolean())}. -type server_capabilities_tools() :: {server_capabilities_tools, gleam@option:option(boolean())}. -type set_level_request() :: {set_level_request, logging_level()}. -type subscribe_request() :: {subscribe_request, binary()}. -type text_content() :: {text_content, gleam@option:option(annotations()), binary(), binary()}. -type text_resource_contents() :: {text_resource_contents, gleam@option:option(binary()), binary(), binary()}. -type tool() :: {tool, gleam@option:option(tool_annotations()), gleam@option:option(binary()), tool_input_schema(), binary()}. -type tool_annotations() :: {tool_annotations, gleam@option:option(boolean()), gleam@option:option(boolean()), gleam@option:option(boolean()), gleam@option:option(boolean()), gleam@option:option(binary())}. -opaque tool_input_schema() :: {tool_input_schema, mcp_toolkit@core@json_schema:object_schema()}. -type tool_list_changed_notification() :: {tool_list_changed_notification, gleam@option:option(meta())}. -type unsubscribe_request() :: {unsubscribe_request, binary()}. -file("src/mcp_toolkit/core/protocol.gleam", 269). -spec client_capabilities_sampling_decoder() -> gleam@dynamic@decode:decoder(client_capabilities_sampling()). client_capabilities_sampling_decoder() -> gleam@dynamic@decode:success(client_capabilities_sampling). -file("src/mcp_toolkit/core/protocol.gleam", 275). -spec client_capabilities_sampling_to_json(client_capabilities_sampling()) -> gleam@json:json(). client_capabilities_sampling_to_json(_) -> gleam@json:object([]). -file("src/mcp_toolkit/core/protocol.gleam", 310). -spec complete_request_argument_decoder() -> gleam@dynamic@decode:decoder(complete_request_argument()). complete_request_argument_decoder() -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:field( <<"value"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Value) -> gleam@dynamic@decode:success( {complete_request_argument, Name, Value} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 316). -spec complete_request_argument_to_json(complete_request_argument()) -> gleam@json:json(). complete_request_argument_to_json(Complete_request_argument) -> {complete_request_argument, Name, Value} = Complete_request_argument, gleam@json:object( [{<<"name"/utf8>>, gleam@json:string(Name)}, {<<"value"/utf8>>, gleam@json:string(Value)}] ). -file("src/mcp_toolkit/core/protocol.gleam", 388). -spec content_type_decoder() -> gleam@dynamic@decode:decoder(content_type()). content_type_decoder() -> gleam@dynamic@decode:then( {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Variant) -> case Variant of <<"text"/utf8>> -> gleam@dynamic@decode:success(content_type_text); <<"image"/utf8>> -> gleam@dynamic@decode:success(content_type_image); <<"audio"/utf8>> -> gleam@dynamic@decode:success(content_type_audio); <<"resource"/utf8>> -> gleam@dynamic@decode:success(content_type_resource); _ -> gleam@dynamic@decode:failure( content_type_text, <<"ContentType"/utf8>> ) end end ). -file("src/mcp_toolkit/core/protocol.gleam", 399). -spec content_type_to_json(content_type()) -> gleam@json:json(). content_type_to_json(Content_type) -> case Content_type of content_type_text -> gleam@json:string(<<"text"/utf8>>); content_type_image -> gleam@json:string(<<"image"/utf8>>); content_type_audio -> gleam@json:string(<<"audio"/utf8>>); content_type_resource -> gleam@json:string(<<"resource"/utf8>>) end. -file("src/mcp_toolkit/core/protocol.gleam", 504). -spec include_context_decoder() -> gleam@dynamic@decode:decoder(include_context()). include_context_decoder() -> gleam@dynamic@decode:then( {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Variant) -> case Variant of <<"allServers"/utf8>> -> gleam@dynamic@decode:success(all_servers); <<"none"/utf8>> -> gleam@dynamic@decode:success(none); <<"thisServer"/utf8>> -> gleam@dynamic@decode:success(this_server); _ -> gleam@dynamic@decode:failure( none, <<"IncludeContext"/utf8>> ) end end ). -file("src/mcp_toolkit/core/protocol.gleam", 514). -spec include_context_to_json(include_context()) -> gleam@json:json(). include_context_to_json(Include_context) -> case Include_context of all_servers -> gleam@json:string(<<"allServers"/utf8>>); none -> gleam@json:string(<<"none"/utf8>>); this_server -> gleam@json:string(<<"thisServer"/utf8>>) end. -file("src/mcp_toolkit/core/protocol.gleam", 713). -spec implementation_decoder() -> gleam@dynamic@decode:decoder(implementation()). implementation_decoder() -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:field( <<"version"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Version) -> gleam@dynamic@decode:success( {implementation, Name, Version} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 719). -spec implementation_to_json(implementation()) -> gleam@json:json(). implementation_to_json(Implementation) -> {implementation, Name, Version} = Implementation, gleam@json:object( [{<<"name"/utf8>>, gleam@json:string(Name)}, {<<"version"/utf8>>, gleam@json:string(Version)}] ). -file("src/mcp_toolkit/core/protocol.gleam", 835). -spec progress_token_decoder() -> gleam@dynamic@decode:decoder(progress_token()). progress_token_decoder() -> String = begin _pipe = {decoder, fun gleam@dynamic@decode:decode_string/1}, gleam@dynamic@decode:map( _pipe, fun(Field@0) -> {progress_token_string, Field@0} end ) end, Int = begin _pipe@1 = {decoder, fun gleam@dynamic@decode:decode_int/1}, gleam@dynamic@decode:map( _pipe@1, fun(Field@0) -> {progress_token_int, Field@0} end ) end, gleam@dynamic@decode:one_of(String, [Int]). -file("src/mcp_toolkit/core/protocol.gleam", 841). -spec progress_token_to_json(progress_token()) -> gleam@json:json(). progress_token_to_json(Token) -> case Token of {progress_token_string, S} -> gleam@json:string(S); {progress_token_int, I} -> gleam@json:int(I) end. -file("src/mcp_toolkit/core/protocol.gleam", 1083). -spec logging_level_decoder() -> gleam@dynamic@decode:decoder(logging_level()). logging_level_decoder() -> gleam@dynamic@decode:then( {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Variant) -> case Variant of <<"alert"/utf8>> -> gleam@dynamic@decode:success(alert); <<"critical"/utf8>> -> gleam@dynamic@decode:success(critical); <<"debug"/utf8>> -> gleam@dynamic@decode:success(debug); <<"emergency"/utf8>> -> gleam@dynamic@decode:success(emergency); <<"error"/utf8>> -> gleam@dynamic@decode:success(error); <<"info"/utf8>> -> gleam@dynamic@decode:success(info); <<"notice"/utf8>> -> gleam@dynamic@decode:success(notice); <<"warning"/utf8>> -> gleam@dynamic@decode:success(warning); _ -> gleam@dynamic@decode:failure(error, <<"LoggingLevel"/utf8>>) end end ). -file("src/mcp_toolkit/core/protocol.gleam", 1098). -spec logging_level_to_json(logging_level()) -> gleam@json:json(). logging_level_to_json(Logging_level) -> case Logging_level of alert -> gleam@json:string(<<"alert"/utf8>>); critical -> gleam@json:string(<<"critical"/utf8>>); debug -> gleam@json:string(<<"debug"/utf8>>); emergency -> gleam@json:string(<<"emergency"/utf8>>); error -> gleam@json:string(<<"error"/utf8>>); info -> gleam@json:string(<<"info"/utf8>>); notice -> gleam@json:string(<<"notice"/utf8>>); warning -> gleam@json:string(<<"warning"/utf8>>) end. -file("src/mcp_toolkit/core/protocol.gleam", 1245). -spec ping_result_decoder() -> gleam@dynamic@decode:decoder(ping_result()). ping_result_decoder() -> gleam@dynamic@decode:success(ping_result). -file("src/mcp_toolkit/core/protocol.gleam", 1249). -spec ping_result_to_json(ping_result()) -> gleam@json:json(). ping_result_to_json(_) -> gleam@json:object([]). -file("src/mcp_toolkit/core/protocol.gleam", 1419). -spec prompt_reference_decoder() -> gleam@dynamic@decode:decoder(prompt_reference()). prompt_reference_decoder() -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:field( <<"type"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Type_) -> gleam@dynamic@decode:success( {prompt_reference, Name, Type_} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1425). -spec prompt_reference_to_json(prompt_reference()) -> gleam@json:json(). prompt_reference_to_json(Prompt_reference) -> {prompt_reference, Name, Type_} = Prompt_reference, gleam@json:object( [{<<"name"/utf8>>, gleam@json:string(Name)}, {<<"type"/utf8>>, gleam@json:string(Type_)}] ). -file("src/mcp_toolkit/core/protocol.gleam", 1438). -spec read_resource_request_decoder() -> gleam@dynamic@decode:decoder(read_resource_request()). read_resource_request_decoder() -> gleam@dynamic@decode:field( <<"uri"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri) -> gleam@dynamic@decode:success({read_resource_request, Uri}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1443). -spec read_resource_request_to_json(read_resource_request()) -> gleam@json:json(). read_resource_request_to_json(Read_resource_request) -> {read_resource_request, Uri} = Read_resource_request, gleam@json:object([{<<"uri"/utf8>>, gleam@json:string(Uri)}]). -file("src/mcp_toolkit/core/protocol.gleam", 1557). -spec resource_reference_decoder() -> gleam@dynamic@decode:decoder(resource_reference()). resource_reference_decoder() -> gleam@dynamic@decode:field( <<"type"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Type_) -> gleam@dynamic@decode:field( <<"uri"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri) -> gleam@dynamic@decode:success( {resource_reference, Type_, Uri} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 328). -spec complete_request_reference_decoder() -> gleam@dynamic@decode:decoder(complete_request_reference()). complete_request_reference_decoder() -> Prompt = begin _pipe = prompt_reference_decoder(), gleam@dynamic@decode:map( _pipe, fun(Field@0) -> {complete_request_prompt_reference, Field@0} end ) end, Resource = begin _pipe@1 = resource_reference_decoder(), gleam@dynamic@decode:map( _pipe@1, fun(Field@0) -> {complete_request_resource_reference, Field@0} end ) end, gleam@dynamic@decode:one_of(Resource, [Prompt]). -file("src/mcp_toolkit/core/protocol.gleam", 292). -spec complete_request_decoder() -> gleam@dynamic@decode:decoder(complete_request()). complete_request_decoder() -> gleam@dynamic@decode:field( <<"argument"/utf8>>, complete_request_argument_decoder(), fun(Argument) -> gleam@dynamic@decode:field( <<"ref"/utf8>>, complete_request_reference_decoder(), fun(Ref) -> gleam@dynamic@decode:success( {complete_request, Argument, Ref} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1563). -spec resource_reference_to_json(resource_reference()) -> gleam@json:json(). resource_reference_to_json(Resource_reference) -> {resource_reference, Type_, Uri} = Resource_reference, gleam@json:object( [{<<"type"/utf8>>, gleam@json:string(Type_)}, {<<"uri"/utf8>>, gleam@json:string(Uri)}] ). -file("src/mcp_toolkit/core/protocol.gleam", 336). -spec complete_request_reference_to_json(complete_request_reference()) -> gleam@json:json(). complete_request_reference_to_json(Complete_request_reference) -> case Complete_request_reference of {complete_request_prompt_reference, Ref} -> prompt_reference_to_json(Ref); {complete_request_resource_reference, Ref@1} -> resource_reference_to_json(Ref@1) end. -file("src/mcp_toolkit/core/protocol.gleam", 298). -spec complete_request_to_json(complete_request()) -> gleam@json:json(). complete_request_to_json(Complete_request) -> {complete_request, Argument, Ref} = Complete_request, gleam@json:object( [{<<"argument"/utf8>>, complete_request_argument_to_json(Argument)}, {<<"ref"/utf8>>, complete_request_reference_to_json(Ref)}] ). -file("src/mcp_toolkit/core/protocol.gleam", 1619). -spec resource_updated_notification_decoder() -> gleam@dynamic@decode:decoder(resource_updated_notification()). resource_updated_notification_decoder() -> gleam@dynamic@decode:field( <<"uri"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri) -> gleam@dynamic@decode:success({resource_updated_notification, Uri}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1626). -spec resource_updated_notification_to_json(resource_updated_notification()) -> gleam@json:json(). resource_updated_notification_to_json(Resource_updated_notification) -> {resource_updated_notification, Uri} = Resource_updated_notification, gleam@json:object([{<<"uri"/utf8>>, gleam@json:string(Uri)}]). -file("src/mcp_toolkit/core/protocol.gleam", 1642). -spec role_decoder() -> gleam@dynamic@decode:decoder(role()). role_decoder() -> gleam@dynamic@decode:then( {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Variant) -> case Variant of <<"user"/utf8>> -> gleam@dynamic@decode:success(user); <<"assistant"/utf8>> -> gleam@dynamic@decode:success(assistant); _ -> gleam@dynamic@decode:failure(user, <<"Role"/utf8>>) end end ). -file("src/mcp_toolkit/core/protocol.gleam", 1651). -spec role_to_json(role()) -> gleam@json:json(). role_to_json(Role) -> case Role of user -> gleam@json:string(<<"user"/utf8>>); assistant -> gleam@json:string(<<"assistant"/utf8>>) end. -file("src/mcp_toolkit/core/protocol.gleam", 1781). -spec server_capabilities_completions_decoder() -> gleam@dynamic@decode:decoder(server_capabilities_completions()). server_capabilities_completions_decoder() -> gleam@dynamic@decode:success(server_capabilities_completions). -file("src/mcp_toolkit/core/protocol.gleam", 1787). -spec server_capabilities_completions_to_json(server_capabilities_completions()) -> gleam@json:json(). server_capabilities_completions_to_json(_) -> gleam@json:object([]). -file("src/mcp_toolkit/core/protocol.gleam", 1797). -spec server_capabilities_logging_decoder() -> gleam@dynamic@decode:decoder(server_capabilities_logging()). server_capabilities_logging_decoder() -> gleam@dynamic@decode:success(server_capabilities_logging). -file("src/mcp_toolkit/core/protocol.gleam", 1803). -spec server_capabilities_logging_to_json(server_capabilities_logging()) -> gleam@json:json(). server_capabilities_logging_to_json(_) -> gleam@json:object([]). -file("src/mcp_toolkit/core/protocol.gleam", 1877). -spec set_level_request_decoder() -> gleam@dynamic@decode:decoder(set_level_request()). set_level_request_decoder() -> gleam@dynamic@decode:field( <<"level"/utf8>>, logging_level_decoder(), fun(Level) -> gleam@dynamic@decode:success({set_level_request, Level}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1882). -spec set_level_request_to_json(set_level_request()) -> gleam@json:json(). set_level_request_to_json(Set_level_request) -> {set_level_request, Level} = Set_level_request, gleam@json:object([{<<"level"/utf8>>, logging_level_to_json(Level)}]). -file("src/mcp_toolkit/core/protocol.gleam", 1895). -spec subscribe_request_decoder() -> gleam@dynamic@decode:decoder(subscribe_request()). subscribe_request_decoder() -> gleam@dynamic@decode:field( <<"uri"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri) -> gleam@dynamic@decode:success({subscribe_request, Uri}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1900). -spec subscribe_request_to_json(subscribe_request()) -> gleam@json:json(). subscribe_request_to_json(Subscribe_request) -> {subscribe_request, Uri} = Subscribe_request, gleam@json:object([{<<"uri"/utf8>>, gleam@json:string(Uri)}]). -file("src/mcp_toolkit/core/protocol.gleam", 2024). -spec tool_input_schema_decoder() -> gleam@dynamic@decode:decoder(tool_input_schema()). tool_input_schema_decoder() -> Default = {tool_input_schema, {object_schema, [], [], none, []}}, gleam@dynamic@decode:new_primitive_decoder( <<"ToolInputSchema"/utf8>>, fun(Data) -> case gleam@dynamic@decode:run( Data, gleam@dynamic@decode:at( [<<"type"/utf8>>], {decoder, fun gleam@dynamic@decode:decode_string/1} ) ) of {ok, <<"object"/utf8>>} -> case mcp_toolkit@core@json_schema:decode_object_schema(Data) of {ok, Schema} -> {ok, {tool_input_schema, Schema}}; {error, _} -> {error, Default} end; _ -> {error, Default} end end ). -file("src/mcp_toolkit/core/protocol.gleam", 2018). -spec tool_input_schema(binary()) -> {ok, tool_input_schema()} | {error, gleam@json:decode_error()}. tool_input_schema(Json) -> gleam@json:parse(Json, tool_input_schema_decoder()). -file("src/mcp_toolkit/core/protocol.gleam", 2046). -spec tool_input_schema_to_json(tool_input_schema()) -> gleam@json:json(). tool_input_schema_to_json(Schema) -> {tool_input_schema, Schema@1} = Schema, _pipe = [{<<"type"/utf8>>, gleam@json:string(<<"object"/utf8>>)} | mcp_toolkit@core@json_schema:object_schema_to_json(Schema@1)], gleam@json:object(_pipe). -file("src/mcp_toolkit/core/protocol.gleam", 2097). -spec unsubscribe_request_decoder() -> gleam@dynamic@decode:decoder(unsubscribe_request()). unsubscribe_request_decoder() -> gleam@dynamic@decode:field( <<"uri"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri) -> gleam@dynamic@decode:success({unsubscribe_request, Uri}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 2102). -spec unsubscribe_request_to_json(unsubscribe_request()) -> gleam@json:json(). unsubscribe_request_to_json(Unsubscribe_request) -> {unsubscribe_request, Uri} = Unsubscribe_request, gleam@json:object([{<<"uri"/utf8>>, gleam@json:string(Uri)}]). -file("src/mcp_toolkit/core/protocol.gleam", 2109). -spec omittable_field( any(), gleam@dynamic@decode:decoder(WZM), fun((gleam@option:option(WZM)) -> gleam@dynamic@decode:decoder(WZP)) ) -> gleam@dynamic@decode:decoder(WZP). omittable_field(Name, Decoder, Next) -> gleam@dynamic@decode:optional_field( Name, none, gleam@dynamic@decode:optional(Decoder), Next ). -file("src/mcp_toolkit/core/protocol.gleam", 27). -spec annotations_decoder() -> gleam@dynamic@decode:decoder(annotations()). annotations_decoder() -> omittable_field( <<"audience"/utf8>>, gleam@dynamic@decode:list(role_decoder()), fun(Audience) -> omittable_field( <<"priority"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_float/1}, fun(Priority) -> gleam@dynamic@decode:success( {annotations, Audience, Priority} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 50). -spec audio_content_decoder() -> gleam@dynamic@decode:decoder(audio_content()). audio_content_decoder() -> gleam@dynamic@decode:field( <<"type"/utf8>>, content_type_decoder(), fun(Type_) -> gleam@dynamic@decode:field( <<"data"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Data) -> gleam@dynamic@decode:field( <<"mimeType"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Mime_type) -> omittable_field( <<"annotations"/utf8>>, annotations_decoder(), fun(Annotations) -> gleam@dynamic@decode:success( {audio_content, Annotations, Data, Mime_type, Type_} ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 73). -spec blob_resource_contents_decoder() -> gleam@dynamic@decode:decoder(blob_resource_contents()). blob_resource_contents_decoder() -> gleam@dynamic@decode:field( <<"uri"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri) -> gleam@dynamic@decode:field( <<"blob"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Blob) -> omittable_field( <<"mimeType"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Mime_type) -> gleam@dynamic@decode:success( {blob_resource_contents, Blob, Mime_type, Uri} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 97). -spec call_tool_request_decoder(gleam@dynamic@decode:decoder(WVV)) -> gleam@dynamic@decode:decoder(call_tool_request(WVV)). call_tool_request_decoder(Arguments_decoder) -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> omittable_field( <<"arguments"/utf8>>, Arguments_decoder, fun(Arguments) -> gleam@dynamic@decode:success( {call_tool_request, Name, Arguments} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 172). -spec meta_decoder() -> gleam@dynamic@decode:decoder(meta()). meta_decoder() -> omittable_field( <<"progressToken"/utf8>>, progress_token_decoder(), fun(Progress_token) -> gleam@dynamic@decode:success({meta, Progress_token}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 201). -spec cancelled_notification_decoder() -> gleam@dynamic@decode:decoder(cancelled_notification()). cancelled_notification_decoder() -> omittable_field( <<"reason"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Reason) -> gleam@dynamic@decode:field( <<"requestId"/utf8>>, jsonrpcx:id_decoder(), fun(Request_id) -> gleam@dynamic@decode:success( {cancelled_notification, Reason, Request_id} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 251). -spec client_capabilities_roots_decoder() -> gleam@dynamic@decode:decoder(client_capabilities_roots()). client_capabilities_roots_decoder() -> omittable_field( <<"listChanged"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(List_changed) -> gleam@dynamic@decode:success( {client_capabilities_roots, List_changed} ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 224). -spec client_capabilities_decoder() -> gleam@dynamic@decode:decoder(client_capabilities()). client_capabilities_decoder() -> omittable_field( <<"roots"/utf8>>, client_capabilities_roots_decoder(), fun(Roots) -> omittable_field( <<"sampling"/utf8>>, client_capabilities_sampling_decoder(), fun(Sampling) -> gleam@dynamic@decode:success( {client_capabilities, Roots, Sampling} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 366). -spec completion_decoder() -> gleam@dynamic@decode:decoder(completion()). completion_decoder() -> omittable_field( <<"hasMore"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Has_more) -> omittable_field( <<"total"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Total) -> gleam@dynamic@decode:field( <<"values"/utf8>>, gleam@dynamic@decode:list( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Values) -> gleam@dynamic@decode:success( {completion, Has_more, Total, Values} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 349). -spec complete_result_decoder() -> gleam@dynamic@decode:decoder(complete_result()). complete_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:field( <<"completion"/utf8>>, completion_decoder(), fun(Completion) -> gleam@dynamic@decode:success( {complete_result, Meta, Completion} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 635). -spec get_prompt_request_decoder() -> gleam@dynamic@decode:decoder(get_prompt_request()). get_prompt_request_decoder() -> omittable_field( <<"arguments"/utf8>>, gleam@dynamic@decode:dict( {decoder, fun gleam@dynamic@decode:decode_string/1}, {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Arguments) -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:success( {get_prompt_request, Arguments, Name} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 690). -spec image_content_decoder() -> gleam@dynamic@decode:decoder(image_content()). image_content_decoder() -> omittable_field( <<"annotations"/utf8>>, annotations_decoder(), fun(Annotations) -> gleam@dynamic@decode:field( <<"data"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Data) -> gleam@dynamic@decode:field( <<"mimeType"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Mime_type) -> gleam@dynamic@decode:field( <<"type"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Type_) -> gleam@dynamic@decode:success( {image_content, Annotations, Data, Mime_type, Type_} ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 736). -spec initialize_request_decoder() -> gleam@dynamic@decode:decoder(initialize_request()). initialize_request_decoder() -> gleam@dynamic@decode:field( <<"capabilities"/utf8>>, client_capabilities_decoder(), fun(Capabilities) -> gleam@dynamic@decode:field( <<"clientInfo"/utf8>>, implementation_decoder(), fun(Client_info) -> gleam@dynamic@decode:field( <<"protocolVersion"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Protocol_version) -> gleam@dynamic@decode:success( {initialize_request, Capabilities, Client_info, Protocol_version} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 817). -spec initialized_notification_decoder() -> gleam@dynamic@decode:decoder(initialized_notification()). initialized_notification_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:success({initialized_notification, Meta}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 856). -spec list_request_decoder() -> gleam@dynamic@decode:decoder(list_request()). list_request_decoder() -> omittable_field( <<"cursor"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Cursor) -> gleam@dynamic@decode:success({list_request, Cursor}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1011). -spec list_roots_request_decoder() -> gleam@dynamic@decode:decoder(list_roots_request()). list_roots_request_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:success({list_roots_request_params, Meta}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1126). -spec logging_message_notification_decoder(gleam@dynamic@decode:decoder(WXS)) -> gleam@dynamic@decode:decoder(logging_message_notification(WXS)). logging_message_notification_decoder(Data_decoder) -> gleam@dynamic@decode:field( <<"data"/utf8>>, Data_decoder, fun(Data) -> gleam@dynamic@decode:field( <<"level"/utf8>>, logging_level_decoder(), fun(Level) -> omittable_field( <<"logger"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Logger) -> gleam@dynamic@decode:success( {logging_message_notification, Data, Level, Logger} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1150). -spec model_hint_decoder() -> gleam@dynamic@decode:decoder(model_hint()). model_hint_decoder() -> omittable_field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:success({model_hint, Name}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1169). -spec model_preferences_decoder() -> gleam@dynamic@decode:decoder(model_preferences()). model_preferences_decoder() -> omittable_field( <<"costPriority"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Cost_priority) -> omittable_field( <<"hints"/utf8>>, gleam@dynamic@decode:list(model_hint_decoder()), fun(Hints) -> omittable_field( <<"intelligencePriority"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Intelligence_priority) -> omittable_field( <<"speedPriority"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Speed_priority) -> gleam@dynamic@decode:success( {model_preferences, Cost_priority, Hints, Intelligence_priority, Speed_priority} ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1231). -spec ping_request_decoder() -> gleam@dynamic@decode:decoder(ping_request()). ping_request_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:success({ping_request, Meta}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1266). -spec progress_notification_decoder() -> gleam@dynamic@decode:decoder(progress_notification()). progress_notification_decoder() -> omittable_field( <<"message"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Message) -> gleam@dynamic@decode:field( <<"progress"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Progress) -> gleam@dynamic@decode:field( <<"progressToken"/utf8>>, progress_token_decoder(), fun(Progress_token) -> omittable_field( <<"total"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Total) -> gleam@dynamic@decode:success( {progress_notification, Message, Progress, Progress_token, Total} ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1331). -spec prompt_argument_decoder() -> gleam@dynamic@decode:decoder(prompt_argument()). prompt_argument_decoder() -> omittable_field( <<"description"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Description) -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> omittable_field( <<"required"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Required) -> gleam@dynamic@decode:success( {prompt_argument, Description, Name, Required} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1302). -spec prompt_decoder() -> gleam@dynamic@decode:decoder(prompt()). prompt_decoder() -> omittable_field( <<"arguments"/utf8>>, gleam@dynamic@decode:list(prompt_argument_decoder()), fun(Arguments) -> omittable_field( <<"description"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Description) -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:success( {prompt, Arguments, Description, Name} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 884). -spec list_prompts_result_decoder() -> gleam@dynamic@decode:decoder(list_prompts_result()). list_prompts_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> omittable_field( <<"nextCursor"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Next_cursor) -> gleam@dynamic@decode:field( <<"prompts"/utf8>>, gleam@dynamic@decode:list(prompt_decoder()), fun(Prompts) -> gleam@dynamic@decode:success( {list_prompts_result, Meta, Next_cursor, Prompts} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1357). -spec prompt_list_changed_notification_decoder() -> gleam@dynamic@decode:decoder(prompt_list_changed_notification()). prompt_list_changed_notification_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:success( {prompt_list_changed_notification, Meta} ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1495). -spec resource_decoder() -> gleam@dynamic@decode:decoder(resource()). resource_decoder() -> omittable_field( <<"annotations"/utf8>>, annotations_decoder(), fun(Annotations) -> omittable_field( <<"description"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Description) -> omittable_field( <<"mimeType"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Mime_type) -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> omittable_field( <<"size"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Size) -> gleam@dynamic@decode:field( <<"uri"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri) -> gleam@dynamic@decode:success( {resource, Annotations, Description, Mime_type, Name, Size, Uri} ) end ) end ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 985). -spec list_resources_result_decoder() -> gleam@dynamic@decode:decoder(list_resources_result()). list_resources_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> omittable_field( <<"nextCursor"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Next_cursor) -> gleam@dynamic@decode:field( <<"resources"/utf8>>, gleam@dynamic@decode:list(resource_decoder()), fun(Resources) -> gleam@dynamic@decode:success( {list_resources_result, Meta, Next_cursor, Resources} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1538). -spec resource_list_changed_notification_decoder() -> gleam@dynamic@decode:decoder(resource_list_changed_notification()). resource_list_changed_notification_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:success( {resource_list_changed_notification, Meta} ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1578). -spec resource_template_decoder() -> gleam@dynamic@decode:decoder(resource_template()). resource_template_decoder() -> omittable_field( <<"annotations"/utf8>>, annotations_decoder(), fun(Annotations) -> omittable_field( <<"description"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Description) -> omittable_field( <<"mimeType"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Mime_type) -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:field( <<"uriTemplate"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri_template) -> gleam@dynamic@decode:success( {resource_template, Annotations, Description, Mime_type, Name, Uri_template} ) end ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 927). -spec list_resource_templates_result_decoder() -> gleam@dynamic@decode:decoder(list_resource_templates_result()). list_resource_templates_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> omittable_field( <<"nextCursor"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Next_cursor) -> gleam@dynamic@decode:field( <<"resourceTemplates"/utf8>>, gleam@dynamic@decode:list(resource_template_decoder()), fun(Resource_templates) -> gleam@dynamic@decode:success( {list_resource_templates_result, Meta, Next_cursor, Resource_templates} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1662). -spec root_decoder() -> gleam@dynamic@decode:decoder(root()). root_decoder() -> omittable_field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:field( <<"uri"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri) -> gleam@dynamic@decode:success({root, Name, Uri}) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1025). -spec list_roots_result_decoder() -> gleam@dynamic@decode:decoder(list_roots_result()). list_roots_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:field( <<"roots"/utf8>>, gleam@dynamic@decode:list(root_decoder()), fun(Roots) -> gleam@dynamic@decode:success( {list_roots_result, Meta, Roots} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1687). -spec roots_list_changed_notification_decoder() -> gleam@dynamic@decode:decoder(roots_list_changed_notification()). roots_list_changed_notification_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:success( {roots_list_changed_notification, Meta} ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1813). -spec server_capabilities_prompts_decoder() -> gleam@dynamic@decode:decoder(server_capabilities_prompts()). server_capabilities_prompts_decoder() -> omittable_field( <<"listChanged"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(List_changed) -> gleam@dynamic@decode:success( {server_capabilities_prompts, List_changed} ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1834). -spec server_capabilities_resources_decoder() -> gleam@dynamic@decode:decoder(server_capabilities_resources()). server_capabilities_resources_decoder() -> omittable_field( <<"listChanged"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(List_changed) -> omittable_field( <<"subscribe"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Subscribe) -> gleam@dynamic@decode:success( {server_capabilities_resources, List_changed, Subscribe} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1857). -spec server_capabilities_tools_decoder() -> gleam@dynamic@decode:decoder(server_capabilities_tools()). server_capabilities_tools_decoder() -> omittable_field( <<"listChanged"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(List_changed) -> gleam@dynamic@decode:success( {server_capabilities_tools, List_changed} ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1730). -spec server_capabilities_decoder() -> gleam@dynamic@decode:decoder(server_capabilities()). server_capabilities_decoder() -> omittable_field( <<"completions"/utf8>>, server_capabilities_completions_decoder(), fun(Completions) -> omittable_field( <<"logging"/utf8>>, server_capabilities_logging_decoder(), fun(Logging) -> omittable_field( <<"prompts"/utf8>>, server_capabilities_prompts_decoder(), fun(Prompts) -> omittable_field( <<"resources"/utf8>>, server_capabilities_resources_decoder(), fun(Resources) -> omittable_field( <<"tools"/utf8>>, server_capabilities_tools_decoder(), fun(Tools) -> gleam@dynamic@decode:success( {server_capabilities, Completions, Logging, Prompts, Resources, Tools} ) end ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 770). -spec initialize_result_decoder() -> gleam@dynamic@decode:decoder(initialize_result()). initialize_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:field( <<"capabilities"/utf8>>, server_capabilities_decoder(), fun(Capabilities) -> omittable_field( <<"instructions"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Instructions) -> gleam@dynamic@decode:field( <<"protocolVersion"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Protocol_version) -> gleam@dynamic@decode:field( <<"serverInfo"/utf8>>, implementation_decoder(), fun(Server_info) -> gleam@dynamic@decode:success( {initialize_result, Meta, Capabilities, Instructions, Protocol_version, Server_info} ) end ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1909). -spec text_content_decoder() -> gleam@dynamic@decode:decoder(text_content()). text_content_decoder() -> omittable_field( <<"annotations"/utf8>>, annotations_decoder(), fun(Annotations) -> gleam@dynamic@decode:field( <<"text"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Text) -> gleam@dynamic@decode:field( <<"type"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Type_) -> gleam@dynamic@decode:success( {text_content, Annotations, Text, Type_} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 568). -spec message_content_decoder() -> gleam@dynamic@decode:decoder(message_content()). message_content_decoder() -> Text = begin _pipe = text_content_decoder(), gleam@dynamic@decode:map( _pipe, fun(Field@0) -> {text_message_content, Field@0} end ) end, Image = begin _pipe@1 = image_content_decoder(), gleam@dynamic@decode:map( _pipe@1, fun(Field@0) -> {image_message_content, Field@0} end ) end, Audio = begin _pipe@2 = audio_content_decoder(), gleam@dynamic@decode:map( _pipe@2, fun(Field@0) -> {audio_message_content, Field@0} end ) end, gleam@dynamic@decode:one_of(Text, [Image, Audio]). -file("src/mcp_toolkit/core/protocol.gleam", 532). -spec create_message_result_decoder() -> gleam@dynamic@decode:decoder(create_message_result()). create_message_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:field( <<"content"/utf8>>, message_content_decoder(), fun(Content) -> gleam@dynamic@decode:field( <<"model"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Model) -> gleam@dynamic@decode:field( <<"role"/utf8>>, role_decoder(), fun(Role) -> omittable_field( <<"stopReason"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Stop_reason) -> gleam@dynamic@decode:success( {create_message_result, Meta, Content, Model, Role, Stop_reason} ) end ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1705). -spec sampling_message_decoder() -> gleam@dynamic@decode:decoder(sampling_message()). sampling_message_decoder() -> gleam@dynamic@decode:field( <<"content"/utf8>>, message_content_decoder(), fun(Content) -> gleam@dynamic@decode:field( <<"role"/utf8>>, role_decoder(), fun(Role) -> gleam@dynamic@decode:success( {sampling_message, Content, Role} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 425). -spec create_message_request_decoder(gleam@dynamic@decode:decoder(WWO)) -> gleam@dynamic@decode:decoder(create_message_request(WWO)). create_message_request_decoder(Metadata_decoder) -> omittable_field( <<"includeContext"/utf8>>, include_context_decoder(), fun(Include_context) -> gleam@dynamic@decode:field( <<"maxTokens"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Max_tokens) -> gleam@dynamic@decode:field( <<"messages"/utf8>>, gleam@dynamic@decode:list(sampling_message_decoder()), fun(Messages) -> omittable_field( <<"metadata"/utf8>>, Metadata_decoder, fun(Metadata) -> omittable_field( <<"modelPreferences"/utf8>>, model_preferences_decoder(), fun(Model_preferences) -> omittable_field( <<"stopSequences"/utf8>>, gleam@dynamic@decode:list( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Stop_sequences) -> omittable_field( <<"systemPrompt"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(System_prompt) -> omittable_field( <<"temperature"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Temperature) -> gleam@dynamic@decode:success( {create_message_request, Include_context, Max_tokens, Messages, Metadata, Model_preferences, Stop_sequences, System_prompt, Temperature} ) end ) end ) end ) end ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1928). -spec text_resource_contents_decoder() -> gleam@dynamic@decode:decoder(text_resource_contents()). text_resource_contents_decoder() -> omittable_field( <<"mimeType"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Mime_type) -> gleam@dynamic@decode:field( <<"text"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Text) -> gleam@dynamic@decode:field( <<"uri"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Uri) -> gleam@dynamic@decode:success( {text_resource_contents, Mime_type, Text, Uri} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 614). -spec resource_contents_decoder() -> gleam@dynamic@decode:decoder(resource_contents()). resource_contents_decoder() -> Text = begin _pipe = text_resource_contents_decoder(), gleam@dynamic@decode:map( _pipe, fun(Field@0) -> {text_resource, Field@0} end ) end, Blob = begin _pipe@1 = blob_resource_contents_decoder(), gleam@dynamic@decode:map( _pipe@1, fun(Field@0) -> {blob_resource, Field@0} end ) end, gleam@dynamic@decode:one_of(Text, [Blob]). -file("src/mcp_toolkit/core/protocol.gleam", 592). -spec embedded_resource_decoder() -> gleam@dynamic@decode:decoder(embedded_resource()). embedded_resource_decoder() -> omittable_field( <<"annotations"/utf8>>, annotations_decoder(), fun(Annotations) -> gleam@dynamic@decode:field( <<"resource"/utf8>>, resource_contents_decoder(), fun(Resource) -> gleam@dynamic@decode:field( <<"type"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Type_) -> gleam@dynamic@decode:success( {embedded_resource, Annotations, Resource, Type_} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 122). -spec tool_result_content_decoder() -> gleam@dynamic@decode:decoder(tool_result_content()). tool_result_content_decoder() -> Text = begin _pipe = text_content_decoder(), gleam@dynamic@decode:map( _pipe, fun(Field@0) -> {text_tool_content, Field@0} end ) end, Image = begin _pipe@1 = image_content_decoder(), gleam@dynamic@decode:map( _pipe@1, fun(Field@0) -> {image_tool_content, Field@0} end ) end, Audio = begin _pipe@2 = audio_content_decoder(), gleam@dynamic@decode:map( _pipe@2, fun(Field@0) -> {audio_tool_content, Field@0} end ) end, Resource = begin _pipe@3 = embedded_resource_decoder(), gleam@dynamic@decode:map( _pipe@3, fun(Field@0) -> {resource_tool_content, Field@0} end ) end, gleam@dynamic@decode:one_of(Text, [Image, Audio, Resource]). -file("src/mcp_toolkit/core/protocol.gleam", 149). -spec call_tool_result_decoder() -> gleam@dynamic@decode:decoder(call_tool_result()). call_tool_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:field( <<"content"/utf8>>, gleam@dynamic@decode:list(tool_result_content_decoder()), fun(Content) -> omittable_field( <<"isError"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Is_error) -> gleam@dynamic@decode:success( {call_tool_result, Meta, Content, Is_error} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1396). -spec prompt_message_content_decoder() -> gleam@dynamic@decode:decoder(prompt_message_content()). prompt_message_content_decoder() -> Text = begin _pipe = text_content_decoder(), gleam@dynamic@decode:map( _pipe, fun(Field@0) -> {text_prompt_content, Field@0} end ) end, Image = begin _pipe@1 = image_content_decoder(), gleam@dynamic@decode:map( _pipe@1, fun(Field@0) -> {image_prompt_content, Field@0} end ) end, Audio = begin _pipe@2 = audio_content_decoder(), gleam@dynamic@decode:map( _pipe@2, fun(Field@0) -> {audio_prompt_content, Field@0} end ) end, Resource = begin _pipe@3 = embedded_resource_decoder(), gleam@dynamic@decode:map( _pipe@3, fun(Field@0) -> {resource_prompt_content, Field@0} end ) end, gleam@dynamic@decode:one_of(Text, [Image, Audio, Resource]). -file("src/mcp_toolkit/core/protocol.gleam", 1375). -spec prompt_message_decoder() -> gleam@dynamic@decode:decoder(prompt_message()). prompt_message_decoder() -> gleam@dynamic@decode:field( <<"content"/utf8>>, prompt_message_content_decoder(), fun(Content) -> gleam@dynamic@decode:field( <<"role"/utf8>>, role_decoder(), fun(Role) -> gleam@dynamic@decode:success( {prompt_message, Content, Role} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 663). -spec get_prompt_result_decoder() -> gleam@dynamic@decode:decoder(get_prompt_result()). get_prompt_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> omittable_field( <<"description"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Description) -> gleam@dynamic@decode:field( <<"messages"/utf8>>, gleam@dynamic@decode:list(prompt_message_decoder()), fun(Messages) -> gleam@dynamic@decode:success( {get_prompt_result, Meta, Description, Messages} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1454). -spec read_resource_result_decoder() -> gleam@dynamic@decode:decoder(read_resource_result()). read_resource_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:field( <<"contents"/utf8>>, gleam@dynamic@decode:list(resource_contents_decoder()), fun(Contents) -> gleam@dynamic@decode:success( {read_resource_result, Meta, Contents} ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1982). -spec tool_annotations_decoder() -> gleam@dynamic@decode:decoder(tool_annotations()). tool_annotations_decoder() -> omittable_field( <<"destructiveHint"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Destructive_hint) -> omittable_field( <<"idempotentHint"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Idempotent_hint) -> omittable_field( <<"openWorldHint"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Open_world_hint) -> omittable_field( <<"readOnlyHint"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Read_only_hint) -> omittable_field( <<"title"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Title) -> gleam@dynamic@decode:success( {tool_annotations, Destructive_hint, Idempotent_hint, Open_world_hint, Read_only_hint, Title} ) end ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1953). -spec tool_decoder() -> gleam@dynamic@decode:decoder(tool()). tool_decoder() -> omittable_field( <<"annotations"/utf8>>, tool_annotations_decoder(), fun(Annotations) -> omittable_field( <<"description"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Description) -> gleam@dynamic@decode:field( <<"inputSchema"/utf8>>, tool_input_schema_decoder(), fun(Input_schema) -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:success( {tool, Annotations, Description, Input_schema, Name} ) end ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1057). -spec list_tools_result_decoder() -> gleam@dynamic@decode:decoder(list_tools_result()). list_tools_result_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> omittable_field( <<"nextCursor"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Next_cursor) -> gleam@dynamic@decode:field( <<"tools"/utf8>>, gleam@dynamic@decode:list(tool_decoder()), fun(Tools) -> gleam@dynamic@decode:success( {list_tools_result, Meta, Next_cursor, Tools} ) end ) end ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 2075). -spec tool_list_changed_notification_decoder() -> gleam@dynamic@decode:decoder(tool_list_changed_notification()). tool_list_changed_notification_decoder() -> omittable_field( <<"_meta"/utf8>>, meta_decoder(), fun(Meta) -> gleam@dynamic@decode:success({tool_list_changed_notification, Meta}) end ). -file("src/mcp_toolkit/core/protocol.gleam", 2117). -spec omittable_to_json( list({binary(), gleam@json:json()}), binary(), gleam@option:option(WZT), fun((WZT) -> gleam@json:json()) ) -> list({binary(), gleam@json:json()}). omittable_to_json(Object, Key, Value, To_json) -> case Value of {some, Value@1} -> [{Key, To_json(Value@1)} | Object]; none -> Object end. -file("src/mcp_toolkit/core/protocol.gleam", 33). -spec annotations_to_json(annotations()) -> gleam@json:json(). annotations_to_json(Annotations) -> {annotations, Audience, Priority} = Annotations, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"audience"/utf8>>, Audience, fun(_capture) -> gleam@json:array(_capture, fun role_to_json/1) end ), _pipe@2 = omittable_to_json( _pipe@1, <<"priority"/utf8>>, Priority, fun gleam@json:float/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 58). -spec audio_content_to_json(audio_content()) -> gleam@json:json(). audio_content_to_json(Audio_content) -> {audio_content, Annotations, Data, Mime_type, Type_} = Audio_content, _pipe = [{<<"type"/utf8>>, content_type_to_json(Type_)}, {<<"data"/utf8>>, gleam@json:string(Data)}, {<<"mimeType"/utf8>>, gleam@json:string(Mime_type)}], _pipe@1 = omittable_to_json( _pipe, <<"annotations"/utf8>>, Annotations, fun annotations_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 80). -spec blob_resource_contents_to_json(blob_resource_contents()) -> gleam@json:json(). blob_resource_contents_to_json(Blob_resource_contents) -> {blob_resource_contents, Blob, Mime_type, Uri} = Blob_resource_contents, _pipe = [{<<"uri"/utf8>>, gleam@json:string(Uri)}, {<<"blob"/utf8>>, gleam@json:string(Blob)}], _pipe@1 = omittable_to_json( _pipe, <<"mimeType"/utf8>>, Mime_type, fun gleam@json:string/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 105). -spec call_tool_request_to_json( call_tool_request(WVZ), fun((WVZ) -> gleam@json:json()) ) -> gleam@json:json(). call_tool_request_to_json(Call_tool_request, To_json) -> {call_tool_request, Name, Arguments} = Call_tool_request, _pipe = [{<<"name"/utf8>>, gleam@json:string(Name)}], _pipe@1 = omittable_to_json(_pipe, <<"arguments"/utf8>>, Arguments, To_json), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 180). -spec meta_to_json(meta()) -> gleam@json:json(). meta_to_json(Meta) -> _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"progressToken"/utf8>>, erlang:element(2, Meta), fun progress_token_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 207). -spec cancelled_notification_to_json(cancelled_notification()) -> gleam@json:json(). cancelled_notification_to_json(Cancelled_notification) -> {cancelled_notification, Reason, Request_id} = Cancelled_notification, _pipe = [{<<"requestId"/utf8>>, jsonrpcx:id_to_json(Request_id)}], _pipe@1 = omittable_to_json( _pipe, <<"reason"/utf8>>, Reason, fun gleam@json:string/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 256). -spec client_capabilities_roots_to_json(client_capabilities_roots()) -> gleam@json:json(). client_capabilities_roots_to_json(Client_capabilities_roots) -> {client_capabilities_roots, List_changed} = Client_capabilities_roots, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"listChanged"/utf8>>, List_changed, fun gleam@json:bool/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 233). -spec client_capabilities_to_json(client_capabilities()) -> gleam@json:json(). client_capabilities_to_json(Client_capabilities) -> {client_capabilities, Roots, Sampling} = Client_capabilities, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"roots"/utf8>>, Roots, fun client_capabilities_roots_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"sampling"/utf8>>, Sampling, fun client_capabilities_sampling_to_json/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 373). -spec completion_to_json(completion()) -> gleam@json:json(). completion_to_json(Completion) -> {completion, Has_more, Total, Values} = Completion, _pipe = [{<<"values"/utf8>>, gleam@json:array(Values, fun gleam@json:string/1)}], _pipe@1 = omittable_to_json( _pipe, <<"hasMore"/utf8>>, Has_more, fun gleam@json:bool/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"total"/utf8>>, Total, fun gleam@json:int/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 355). -spec complete_result_to_json(complete_result()) -> gleam@json:json(). complete_result_to_json(Complete_result) -> {complete_result, Meta, Completion} = Complete_result, _pipe = [{<<"completion"/utf8>>, completion_to_json(Completion)}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 644). -spec get_prompt_request_to_json(get_prompt_request()) -> gleam@json:json(). get_prompt_request_to_json(Get_prompt_request) -> {get_prompt_request, Arguments, Name} = Get_prompt_request, _pipe = [{<<"name"/utf8>>, gleam@json:string(Name)}], _pipe@1 = omittable_to_json( _pipe, <<"arguments"/utf8>>, Arguments, fun(_capture) -> gleam@json:dict( _capture, fun gleam@function:identity/1, fun gleam@json:string/1 ) end ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 698). -spec image_content_to_json(image_content()) -> gleam@json:json(). image_content_to_json(Image_content) -> {image_content, Annotations, Data, Mime_type, Type_} = Image_content, _pipe = [{<<"data"/utf8>>, gleam@json:string(Data)}, {<<"mimeType"/utf8>>, gleam@json:string(Mime_type)}, {<<"type"/utf8>>, gleam@json:string(Type_)}], _pipe@1 = omittable_to_json( _pipe, <<"annotations"/utf8>>, Annotations, fun annotations_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 750). -spec initialize_request_to_json(initialize_request()) -> gleam@json:json(). initialize_request_to_json(Initialize_request) -> {initialize_request, Capabilities, Client_info, Protocol_version} = Initialize_request, gleam@json:object( [{<<"capabilities"/utf8>>, client_capabilities_to_json(Capabilities)}, {<<"clientInfo"/utf8>>, implementation_to_json(Client_info)}, {<<"protocolVersion"/utf8>>, gleam@json:string(Protocol_version)}] ). -file("src/mcp_toolkit/core/protocol.gleam", 822). -spec initialized_notification_to_json(initialized_notification()) -> gleam@json:json(). initialized_notification_to_json(Initialized_notification) -> {initialized_notification, Meta} = Initialized_notification, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 861). -spec list_request_to_json(list_request()) -> gleam@json:json(). list_request_to_json(Request) -> _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"cursor"/utf8>>, erlang:element(2, Request), fun gleam@json:string/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1016). -spec list_roots_request_to_json(list_roots_request()) -> gleam@json:json(). list_roots_request_to_json(List_roots_request) -> {list_roots_request_params, Meta} = List_roots_request, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1135). -spec logging_message_notification_to_json( logging_message_notification(WXW), fun((WXW) -> gleam@json:json()) ) -> gleam@json:json(). logging_message_notification_to_json(Logging_message_notification, To_json) -> {logging_message_notification, Data, Level, Logger} = Logging_message_notification, _pipe = [{<<"data"/utf8>>, To_json(Data)}, {<<"level"/utf8>>, logging_level_to_json(Level)}], _pipe@1 = omittable_to_json( _pipe, <<"logger"/utf8>>, Logger, fun gleam@json:string/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1155). -spec model_hint_to_json(model_hint()) -> gleam@json:json(). model_hint_to_json(Model_hint) -> {model_hint, Name} = Model_hint, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"name"/utf8>>, Name, fun gleam@json:string/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1185). -spec model_preferences_to_json(model_preferences()) -> gleam@json:json(). model_preferences_to_json(Model_preferences) -> {model_preferences, Cost_priority, Hints, Intelligence_priority, Speed_priority} = Model_preferences, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"costPriority"/utf8>>, Cost_priority, fun gleam@json:int/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"hints"/utf8>>, Hints, fun(_capture) -> gleam@json:array(_capture, fun model_hint_to_json/1) end ), _pipe@3 = omittable_to_json( _pipe@2, <<"intelligencePriority"/utf8>>, Intelligence_priority, fun gleam@json:int/1 ), _pipe@4 = omittable_to_json( _pipe@3, <<"speedPriority"/utf8>>, Speed_priority, fun gleam@json:int/1 ), gleam@json:object(_pipe@4). -file("src/mcp_toolkit/core/protocol.gleam", 1236). -spec ping_request_to_json(ping_request()) -> gleam@json:json(). ping_request_to_json(Ping_request) -> {ping_request, Meta} = Ping_request, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1279). -spec progress_notification_to_json(progress_notification()) -> gleam@json:json(). progress_notification_to_json(Progress_notification) -> {progress_notification, Message, Progress, Progress_token, Total} = Progress_notification, gleam@json:object( begin _pipe = [{<<"progress"/utf8>>, gleam@json:int(Progress)}, {<<"progressToken"/utf8>>, progress_token_to_json(Progress_token)}], _pipe@1 = omittable_to_json( _pipe, <<"message"/utf8>>, Message, fun gleam@json:string/1 ), omittable_to_json( _pipe@1, <<"total"/utf8>>, Total, fun gleam@json:int/1 ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1338). -spec prompt_argument_to_json(prompt_argument()) -> gleam@json:json(). prompt_argument_to_json(Prompt_argument) -> {prompt_argument, Description, Name, Required} = Prompt_argument, _pipe = [{<<"name"/utf8>>, gleam@json:string(Name)}], _pipe@1 = omittable_to_json( _pipe, <<"description"/utf8>>, Description, fun gleam@json:string/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"required"/utf8>>, Required, fun gleam@json:bool/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1312). -spec prompt_to_json(prompt()) -> gleam@json:json(). prompt_to_json(Prompt) -> {prompt, Arguments, Description, Name} = Prompt, _pipe = [{<<"name"/utf8>>, gleam@json:string(Name)}], _pipe@1 = omittable_to_json( _pipe, <<"arguments"/utf8>>, Arguments, fun(_capture) -> gleam@json:array(_capture, fun prompt_argument_to_json/1) end ), _pipe@2 = omittable_to_json( _pipe@1, <<"description"/utf8>>, Description, fun gleam@json:string/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 891). -spec list_prompts_result_to_json(list_prompts_result()) -> gleam@json:json(). list_prompts_result_to_json(List_prompts_result) -> {list_prompts_result, Meta, Next_cursor, Prompts} = List_prompts_result, _pipe = [{<<"prompts"/utf8>>, gleam@json:array(Prompts, fun prompt_to_json/1)}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"nextCursor"/utf8>>, Next_cursor, fun gleam@json:string/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1364). -spec prompt_list_changed_notification_to_json( prompt_list_changed_notification() ) -> gleam@json:json(). prompt_list_changed_notification_to_json(Notification) -> {prompt_list_changed_notification, Meta} = Notification, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1512). -spec resource_to_json(resource()) -> gleam@json:json(). resource_to_json(Resource) -> {resource, Annotations, Description, Mime_type, Name, Size, Uri} = Resource, _pipe = [{<<"name"/utf8>>, gleam@json:string(Name)}, {<<"uri"/utf8>>, gleam@json:string(Uri)}], _pipe@1 = omittable_to_json( _pipe, <<"annotations"/utf8>>, Annotations, fun annotations_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"description"/utf8>>, Description, fun gleam@json:string/1 ), _pipe@3 = omittable_to_json( _pipe@2, <<"mimeType"/utf8>>, Mime_type, fun gleam@json:string/1 ), _pipe@4 = omittable_to_json( _pipe@3, <<"size"/utf8>>, Size, fun gleam@json:int/1 ), gleam@json:object(_pipe@4). -file("src/mcp_toolkit/core/protocol.gleam", 992). -spec list_resources_result_to_json(list_resources_result()) -> gleam@json:json(). list_resources_result_to_json(List_resource_result) -> {list_resources_result, Meta, Next_cursor, Resources} = List_resource_result, _pipe = [{<<"resources"/utf8>>, gleam@json:array(Resources, fun resource_to_json/1)}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"nextCursor"/utf8>>, Next_cursor, fun gleam@json:string/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1545). -spec resource_list_changed_notification_to_json( resource_list_changed_notification() ) -> gleam@json:json(). resource_list_changed_notification_to_json(Resource_list_changed_notification) -> {resource_list_changed_notification, Meta} = Resource_list_changed_notification, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1593). -spec resource_template_to_json(resource_template()) -> gleam@json:json(). resource_template_to_json(Resource_template) -> {resource_template, Annotations, Description, Mime_type, Name, Uri_template} = Resource_template, _pipe = [{<<"name"/utf8>>, gleam@json:string(Name)}, {<<"uriTemplate"/utf8>>, gleam@json:string(Uri_template)}], _pipe@1 = omittable_to_json( _pipe, <<"annotations"/utf8>>, Annotations, fun annotations_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"description"/utf8>>, Description, fun gleam@json:string/1 ), _pipe@3 = omittable_to_json( _pipe@2, <<"mimeType"/utf8>>, Mime_type, fun gleam@json:string/1 ), gleam@json:object(_pipe@3). -file("src/mcp_toolkit/core/protocol.gleam", 943). -spec list_resource_templates_result_to_json(list_resource_templates_result()) -> gleam@json:json(). list_resource_templates_result_to_json(List_resource_templates_result) -> {list_resource_templates_result, Meta, Next_cursor, Resource_templates} = List_resource_templates_result, _pipe = [{<<"resourceTemplates"/utf8>>, gleam@json:array( Resource_templates, fun resource_template_to_json/1 )}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"nextCursor"/utf8>>, Next_cursor, fun gleam@json:string/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1668). -spec root_to_json(root()) -> gleam@json:json(). root_to_json(Root) -> {root, Name, Uri} = Root, gleam@json:object( begin _pipe = [{<<"uri"/utf8>>, gleam@json:string(Uri)}], omittable_to_json( _pipe, <<"name"/utf8>>, Name, fun gleam@json:string/1 ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 1031). -spec encode_list_roots_result(list_roots_result()) -> gleam@json:json(). encode_list_roots_result(List_roots_result) -> {list_roots_result, Meta, Roots} = List_roots_result, _pipe = [{<<"roots"/utf8>>, gleam@json:array(Roots, fun root_to_json/1)}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1694). -spec roots_list_changed_notification_to_json(roots_list_changed_notification()) -> gleam@json:json(). roots_list_changed_notification_to_json(Roots_list_changed_notification) -> {roots_list_changed_notification, Meta} = Roots_list_changed_notification, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1820). -spec server_capabilities_prompts_to_json(server_capabilities_prompts()) -> gleam@json:json(). server_capabilities_prompts_to_json(Server_capabilities_prompts) -> {server_capabilities_prompts, List_changed} = Server_capabilities_prompts, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"listChanged"/utf8>>, List_changed, fun gleam@json:bool/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1842). -spec server_capabilities_resources_to_json(server_capabilities_resources()) -> gleam@json:json(). server_capabilities_resources_to_json(Server_capabilities_resources) -> {server_capabilities_resources, List_changed, Subscribe} = Server_capabilities_resources, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"listChanged"/utf8>>, List_changed, fun gleam@json:bool/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"subscribe"/utf8>>, Subscribe, fun gleam@json:bool/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1862). -spec server_capabilities_tools_to_json(server_capabilities_tools()) -> gleam@json:json(). server_capabilities_tools_to_json(Server_capabilities_tools) -> {server_capabilities_tools, List_changed} = Server_capabilities_tools, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"listChanged"/utf8>>, List_changed, fun gleam@json:bool/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1757). -spec server_capabilities_to_json(server_capabilities()) -> gleam@json:json(). server_capabilities_to_json(Capabilities) -> {server_capabilities, Completions, Logging, Prompts, Resources, Tools} = Capabilities, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"completions"/utf8>>, Completions, fun server_capabilities_completions_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"logging"/utf8>>, Logging, fun server_capabilities_logging_to_json/1 ), _pipe@3 = omittable_to_json( _pipe@2, <<"prompts"/utf8>>, Prompts, fun server_capabilities_prompts_to_json/1 ), _pipe@4 = omittable_to_json( _pipe@3, <<"resources"/utf8>>, Resources, fun server_capabilities_resources_to_json/1 ), _pipe@5 = omittable_to_json( _pipe@4, <<"tools"/utf8>>, Tools, fun server_capabilities_tools_to_json/1 ), gleam@json:object(_pipe@5). -file("src/mcp_toolkit/core/protocol.gleam", 788). -spec initialize_result_to_json(initialize_result()) -> gleam@json:json(). initialize_result_to_json(Initialize_result) -> {initialize_result, Meta, Capabilities, Instructions, Protocol_version, Server_info} = Initialize_result, _pipe = [{<<"capabilities"/utf8>>, server_capabilities_to_json(Capabilities)}, {<<"protocolVersion"/utf8>>, gleam@json:string(Protocol_version)}, {<<"serverInfo"/utf8>>, implementation_to_json(Server_info)}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"instructions"/utf8>>, Instructions, fun gleam@json:string/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1916). -spec text_content_to_json(text_content()) -> gleam@json:json(). text_content_to_json(Text_content) -> {text_content, Annotations, Text, Type_} = Text_content, gleam@json:object( begin _pipe = [{<<"text"/utf8>>, gleam@json:string(Text)}, {<<"type"/utf8>>, gleam@json:string(Type_)}], omittable_to_json( _pipe, <<"annotations"/utf8>>, Annotations, fun annotations_to_json/1 ) end ). -file("src/mcp_toolkit/core/protocol.gleam", 576). -spec message_content_to_json(message_content()) -> gleam@json:json(). message_content_to_json(Content) -> case Content of {text_message_content, Content@1} -> text_content_to_json(Content@1); {image_message_content, Content@2} -> image_content_to_json(Content@2); {audio_message_content, Content@3} -> audio_content_to_json(Content@3) end. -file("src/mcp_toolkit/core/protocol.gleam", 547). -spec create_message_result_to_json(create_message_result()) -> gleam@json:json(). create_message_result_to_json(Create_message_result) -> {create_message_result, Meta, Content, Model, Role, Stop_reason} = Create_message_result, _pipe = [{<<"content"/utf8>>, message_content_to_json(Content)}, {<<"model"/utf8>>, gleam@json:string(Model)}, {<<"role"/utf8>>, role_to_json(Role)}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"stopReason"/utf8>>, Stop_reason, fun gleam@json:string/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1711). -spec sampling_message_to_json(sampling_message()) -> gleam@json:json(). sampling_message_to_json(Sampling_message) -> {sampling_message, Content, Role} = Sampling_message, gleam@json:object( [{<<"content"/utf8>>, message_content_to_json(Content)}, {<<"role"/utf8>>, role_to_json(Role)}] ). -file("src/mcp_toolkit/core/protocol.gleam", 460). -spec create_message_request_to_json( create_message_request(WWS), fun((WWS) -> gleam@json:json()) ) -> gleam@json:json(). create_message_request_to_json(Create_message_request, To_json) -> {create_message_request, Include_context, Max_tokens, Messages, Metadata, Model_preferences, Stop_sequences, System_prompt, Temperature} = Create_message_request, _pipe = [{<<"maxTokens"/utf8>>, gleam@json:int(Max_tokens)}, {<<"messages"/utf8>>, gleam@json:array(Messages, fun sampling_message_to_json/1)}], _pipe@1 = omittable_to_json( _pipe, <<"includeContext"/utf8>>, Include_context, fun include_context_to_json/1 ), _pipe@2 = omittable_to_json(_pipe@1, <<"metadata"/utf8>>, Metadata, To_json), _pipe@3 = omittable_to_json( _pipe@2, <<"modelPreferences"/utf8>>, Model_preferences, fun model_preferences_to_json/1 ), _pipe@4 = omittable_to_json( _pipe@3, <<"stopSequences"/utf8>>, Stop_sequences, fun(_capture) -> gleam@json:array(_capture, fun gleam@json:string/1) end ), _pipe@5 = omittable_to_json( _pipe@4, <<"systemPrompt"/utf8>>, System_prompt, fun gleam@json:string/1 ), _pipe@6 = omittable_to_json( _pipe@5, <<"temperature"/utf8>>, Temperature, fun gleam@json:int/1 ), gleam@json:object(_pipe@6). -file("src/mcp_toolkit/core/protocol.gleam", 1935). -spec text_resource_contents_to_json(text_resource_contents()) -> gleam@json:json(). text_resource_contents_to_json(Text_resource_contents) -> {text_resource_contents, Mime_type, Text, Uri} = Text_resource_contents, _pipe = [{<<"text"/utf8>>, gleam@json:string(Text)}, {<<"uri"/utf8>>, gleam@json:string(Uri)}], _pipe@1 = omittable_to_json( _pipe, <<"mimeType"/utf8>>, Mime_type, fun gleam@json:string/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 620). -spec resource_contents_to_json(resource_contents()) -> gleam@json:json(). resource_contents_to_json(Resource_contents) -> case Resource_contents of {blob_resource, Res} -> blob_resource_contents_to_json(Res); {text_resource, Res@1} -> text_resource_contents_to_json(Res@1) end. -file("src/mcp_toolkit/core/protocol.gleam", 599). -spec embedded_resource_to_json(embedded_resource()) -> gleam@json:json(). embedded_resource_to_json(Embedded_resource) -> {embedded_resource, Annotations, Resource, Type_} = Embedded_resource, _pipe = [{<<"resource"/utf8>>, resource_contents_to_json(Resource)}, {<<"type"/utf8>>, gleam@json:string(Type_)}], _pipe@1 = omittable_to_json( _pipe, <<"annotations"/utf8>>, Annotations, fun annotations_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 130). -spec tool_result_content_to_json(tool_result_content()) -> gleam@json:json(). tool_result_content_to_json(Tool_result_content) -> case Tool_result_content of {text_tool_content, Content} -> text_content_to_json(Content); {image_tool_content, Content@1} -> image_content_to_json(Content@1); {audio_tool_content, Content@2} -> audio_content_to_json(Content@2); {resource_tool_content, Content@3} -> embedded_resource_to_json(Content@3) end. -file("src/mcp_toolkit/core/protocol.gleam", 159). -spec call_tool_result_to_json(call_tool_result()) -> gleam@json:json(). call_tool_result_to_json(Call_tool_result) -> {call_tool_result, Meta, Content, Is_error} = Call_tool_result, _pipe = [{<<"content"/utf8>>, gleam@json:array(Content, fun tool_result_content_to_json/1)}], _pipe@1 = omittable_to_json( _pipe, <<"isError"/utf8>>, Is_error, fun gleam@json:bool/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1406). -spec prompt_message_content_to_json(prompt_message_content()) -> gleam@json:json(). prompt_message_content_to_json(Content) -> case Content of {text_prompt_content, Content@1} -> text_content_to_json(Content@1); {image_prompt_content, Content@2} -> image_content_to_json(Content@2); {audio_prompt_content, Content@3} -> audio_content_to_json(Content@3); {resource_prompt_content, Content@4} -> embedded_resource_to_json(Content@4) end. -file("src/mcp_toolkit/core/protocol.gleam", 1381). -spec prompt_message_to_json(prompt_message()) -> gleam@json:json(). prompt_message_to_json(Prompt_message) -> {prompt_message, Content, Role} = Prompt_message, gleam@json:object( [{<<"content"/utf8>>, prompt_message_content_to_json(Content)}, {<<"role"/utf8>>, role_to_json(Role)}] ). -file("src/mcp_toolkit/core/protocol.gleam", 673). -spec get_prompt_result_to_json(get_prompt_result()) -> gleam@json:json(). get_prompt_result_to_json(Get_prompt_result) -> {get_prompt_result, Meta, Description, Messages} = Get_prompt_result, _pipe = [{<<"messages"/utf8>>, gleam@json:array(Messages, fun prompt_message_to_json/1)}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"description"/utf8>>, Description, fun gleam@json:string/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1463). -spec read_resource_result_to_json(read_resource_result()) -> gleam@json:json(). read_resource_result_to_json(Read_resource_result) -> {read_resource_result, Meta, Contents} = Read_resource_result, _pipe = [{<<"contents"/utf8>>, gleam@json:array(Contents, fun resource_contents_to_json/1)}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1). -file("src/mcp_toolkit/core/protocol.gleam", 1997). -spec tool_annotations_to_json(tool_annotations()) -> gleam@json:json(). tool_annotations_to_json(Tool_annotations) -> {tool_annotations, Destructive_hint, Idempotent_hint, Open_world_hint, Read_only_hint, Title} = Tool_annotations, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"destructiveHint"/utf8>>, Destructive_hint, fun gleam@json:bool/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"idempotentHint"/utf8>>, Idempotent_hint, fun gleam@json:bool/1 ), _pipe@3 = omittable_to_json( _pipe@2, <<"openWorldHint"/utf8>>, Open_world_hint, fun gleam@json:bool/1 ), _pipe@4 = omittable_to_json( _pipe@3, <<"readOnlyHint"/utf8>>, Read_only_hint, fun gleam@json:bool/1 ), _pipe@5 = omittable_to_json( _pipe@4, <<"title"/utf8>>, Title, fun gleam@json:string/1 ), gleam@json:object(_pipe@5). -file("src/mcp_toolkit/core/protocol.gleam", 1961). -spec tool_to_json(tool()) -> gleam@json:json(). tool_to_json(Tool) -> {tool, Annotations, Description, Input_schema, Name} = Tool, _pipe = [{<<"inputSchema"/utf8>>, tool_input_schema_to_json(Input_schema)}, {<<"name"/utf8>>, gleam@json:string(Name)}], _pipe@1 = omittable_to_json( _pipe, <<"annotations"/utf8>>, Annotations, fun tool_annotations_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"description"/utf8>>, Description, fun gleam@json:string/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 1064). -spec list_tools_result_to_json(list_tools_result()) -> gleam@json:json(). list_tools_result_to_json(List_tools_result) -> {list_tools_result, Meta, Next_cursor, Tools} = List_tools_result, _pipe = [{<<"tools"/utf8>>, gleam@json:array(Tools, fun tool_to_json/1)}], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), _pipe@2 = omittable_to_json( _pipe@1, <<"nextCursor"/utf8>>, Next_cursor, fun gleam@json:string/1 ), gleam@json:object(_pipe@2). -file("src/mcp_toolkit/core/protocol.gleam", 2082). -spec tool_list_changed_notification_to_json(tool_list_changed_notification()) -> gleam@json:json(). tool_list_changed_notification_to_json(Tool_list_changed_notification) -> {tool_list_changed_notification, Meta} = Tool_list_changed_notification, _pipe = [], _pipe@1 = omittable_to_json( _pipe, <<"_meta"/utf8>>, Meta, fun meta_to_json/1 ), gleam@json:object(_pipe@1).