BB.MCP.JsonSchema (bb_mcp v0.1.0)

Copy Markdown View Source

Converts BB command argument definitions into JSON Schema fragments.

Used to advertise command argument types to MCP clients via the list_commands tool, so agents can know what to pass to invoke_command.

Maps Spark :type values to JSON Schema types:

:integer        -> %{"type" => "integer"}
:float, :number -> %{"type" => "number"}
:boolean        -> %{"type" => "boolean"}
:string         -> %{"type" => "string"}
:atom           -> %{"type" => "string", "description" => "atom"}
:map, {:map, fields} -> %{"type" => "object"}
:keyword_list   -> %{"type" => "object"}
:any            -> %{}
module          -> %{"description" => "complex type: #{inspect(module)}"}

Summary

Functions

Build a JSON Schema fragment for a single command argument, including description and default value where present.

Build a JSON Schema object describing a command's arguments.

Functions

for_argument(argument)

@spec for_argument(BB.Dsl.Command.Argument.t()) :: map()

Build a JSON Schema fragment for a single command argument, including description and default value where present.

for_command(command)

@spec for_command(BB.Dsl.Command.t()) :: map()

Build a JSON Schema object describing a command's arguments.