ExMCP.ACP.Maps (ex_mcp v1.0.0-rc.0)

View Source

Small pure map helpers used by ACP protocol, client, agent, and adapters.

The functions intentionally work with string and atom keys because ACP data crosses JSON boundaries while local Elixir call sites often use atom keys.

Summary

Functions

Puts value into map when the value is present and not empty.

Puts value into map when the value is not nil.

Puts value into map unless it equals skip_value.

Functions

camelize_atom(atom)

@spec camelize_atom(atom()) :: String.t()

decapitalize(value)

@spec decapitalize(String.t()) :: String.t()

get(map, key)

@spec get(map() | nil, String.t() | atom()) :: any()

put_non_empty(map, key, value)

@spec put_non_empty(map(), any(), any()) :: map()

Puts value into map when the value is present and not empty.

put_present(map, key, value)

@spec put_present(map(), any(), any()) :: map()

Puts value into map when the value is not nil.

put_unless(map, key, value, skip_value)

@spec put_unless(map(), any(), any(), any()) :: map()

Puts value into map unless it equals skip_value.

stringify_keys(map)

@spec stringify_keys(map()) :: map()

truthy?(arg1)

@spec truthy?(any()) :: boolean()