Scoria.MCP.Tool behaviour (scoria v0.1.3)

Copy Markdown View Source

Scoria.MCP.Tool is the behaviour for host-defined MCP tools that Scoria can register, validate, invoke, and show to reviewers.

Implement this behaviour when a remote connector exposes a tool that should participate in Scoria's connector policy, approval, and audit flow. The host owns the tool's business meaning, argument contract, implementation, and authorization policy. Scoria owns the MCP metadata shape, invocation evidence, and reviewer trace projection.

See guides/capabilities/connectors-and-mcp.md for the connector and MCP capability guide.

Summary

Callbacks

Description of what the tool does

Executes the tool with validated arguments and context

Ecto schemaless map definition for tool arguments

Name of the tool

Callbacks

description()

@callback description() :: String.t()

Description of what the tool does

execute(args, context)

@callback execute(args :: map(), context :: map()) :: {:ok, any()} | {:error, any()}

Executes the tool with validated arguments and context

input_schema()

@callback input_schema() :: map()

Ecto schemaless map definition for tool arguments

name()

@callback name() :: String.t()

Name of the tool