Descripex.MCP (descripex v0.7.0)

Copy Markdown View Source

Converts Descripex-annotated modules into MCP tool definitions.

Each api()-annotated function becomes an MCP tool with name, description, and inputSchema (JSON Schema). Functions without api() annotations are skipped.

Usage

tools = Descripex.MCP.tools([MyLib.Funding, MyLib.Risk])
# => [%{name: "funding__annualize", description: "...", inputSchema: %{...}}, ...]

Tool names use the module's short name (last segment, underscored) joined to the function name with a double underscore. Use name_style: :full for fully-qualified names.

Descripex.MCP.tools([MyLib.Funding], name_style: :full)
# => [%{name: "my_lib_funding__annualize", ...}]

API Functions

FunctionArityDescriptionParam Kinds
tools2Convert Descripex-annotated modules into MCP tool definitions.modules: value, opts: value

Summary

Functions

Convert Descripex-annotated modules into MCP tool definitions.

Functions

tools(modules, opts \\ [])

@spec tools(
  [module()],
  keyword()
) :: [map()]

Convert Descripex-annotated modules into MCP tool definitions.

Parameters

  • modules - List of module atoms to convert (value)
  • opts - Options: name_style (:short | :full) (default: [], value)

Returns

List of MCP tool definition maps with name, description, and inputSchema (list)

Example

[
  %{
    name: "funding__annualize",
    description: "Annualize a per-period funding rate.",
    inputSchema: %{type: "object", required: [], properties: %{}}
  }
]
# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: name_style (:short | :full)",
      kind: :value
    },
    modules: %{description: "List of module atoms to convert", kind: :value}
  },
  returns: %{
    type: :list,
    description: "List of MCP tool definition maps with name, description, and inputSchema"
  },
  returns_example: [
    %{
      name: "funding__annualize",
      description: "Annualize a per-period funding rate.",
      inputSchema: %{type: "object", required: [], properties: %{}}
    }
  ]
}