Beamlet.MCP.Eval (Beamlet v0.1.0)

Copy Markdown View Source

The eval tool, which runs Elixir code on your beamlet.

Each use is a fresh evaluation, with nothing carried over from the last. The code is checked against the token's policy before it runs. It can call what the policy grants and every module agents have defined.

The agent gets back what the code printed, then the value of its last expression. A refused call, an exception or a timeout comes back as text too, so the agent can see what went wrong and try again.

A token has the tool when its policy lists :eval under tools. default does.

Input

{"code": "Shopping.List.items() |> length()"}
  • code - Required. The Elixir code to evaluate.

Configuration

config :beamlet, eval: [timeout: 60_000]
  • :timeout - How long one evaluation may run, in milliseconds. When it runs out, the evaluation stops and the output so far comes back. Defaults to 30 seconds. The MCP server's :request_timeout must stay longer (Beamlet.MCP.Server).
  • :max_heap_bytes - How much memory one evaluation may use. Past it, the evaluation stops before it can take the beamlet down. Defaults to 128 MB.
  • :max_output - How much printed output comes back, in bytes. Longer output is cut, with a line saying how much was shown. Defaults to 32 KB.

Summary

Functions

The description a client lists for the tool, written for the model.

Functions

description()

The description a client lists for the tool, written for the model.

Built when it is read, from the limits above, so it always states the ones in force.

get_schema(atom)

mcp_schema(data)

mcp_schema!(data)

mcp_schema_changeset(data)