# `Beamlet.MCP.Define`
[🔗](https://github.com/aaronrussell/beamlet/blob/v0.1.0/lib/beamlet/mcp/define.ex#L1)

The `define` tool, which compiles modules into your beamlet and
keeps them.

An agent sends one or more modules. Each is checked against the
token's policy and compiled into the running beamlet, ready to call
straight away, and stays across restarts. Either all the modules
land or none do.

Every module is saved in the code dir and committed to its git
history, with the token that wrote it as the author.

A module that exists already is replaced only when its entry says
`replace: true`. The names `Beamlet.*` and `Host.*` are reserved.
Every module needs a `@moduledoc` and every public function a
`@doc`, so the next agent can find its way around.

A token has the tool when its policy lists `:define` under `tools`,
which brings `patch` with it. `default` does.

## Input

```json
{
  "modules": [
    {"code": "defmodule Shopping.List do..."},
    {"code": "defmodule Shopping.Item do...", "replace": true}
  ]
}
```

* `modules` - Required. The modules to define, each with:
  * `code` - Required. The source of one top-level `defmodule`.
  * `replace` - `true` to replace a module that already exists.
    Defaults to `false`.

## Configuration

    config :beamlet, define: [timeout: 60_000]

* `:timeout` - How long one `define` or `patch` may take to
  compile, in milliseconds. Defaults to 30 seconds.

# `description`

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

Built when it is read, from the `timeout` above, so it always
states the one in force.

# `get_schema`

# `mcp_schema`

# `mcp_schema!`

# `mcp_schema_changeset`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
