Skip to main content

Module plugins

Module plugins 

Source
Expand description

Plugins: how the agent is extended without editing it.

A plugin is a directory named after the plugin, containing plugin.toml. Nothing is compiled, loaded as a shared library or interpreted in-process: a plugin declares its tools, prompt fragments, provider profiles and hooks in that one manifest, and the only thing that ever executes is a process the manifest names. That keeps the agent a single static binary, keeps a panic in a plugin out of the agent, and makes a plugin reviewable by reading two files.

What a plugin can add:

SectionAdds
[[tool]]a model-callable tool: a JSON Schema for its arguments plus a command to run
[[prompt]]text appended to the system prompt (inline or from a file)
[[provider_profile]]an OpenAI-compatible wire profile, overriding a built-in of the same name
[[hook]]before_tool (may refuse a tool call) or after_tool (may rewrite its output)
[[mcp]]every tool an MCP server offers, from one stdio JSON-RPC process (see crate::mcp)

What it deliberately cannot do: replace a built-in tool without saying override = true on that tool, and run without being listed in [plugins] enabled. An MCP server is declared once per server in [[mcp]] and contributes all of its tools from there (see crate::mcp); kind = "mcp" on a single [[tool]] is refused with a pointer to it.

See docs/USER.md for the file format and docs/TECHNICAL.md for the execution and trust model.

Structs§

Hook
One [[hook]]. See Hooks for when it runs and what it may do.
HookDef
Hooks
The hooks of every loaded plugin, ready to run around a tool call.
LimitDef
One model’s limits.
Manifest
McpServerState
What mcp list prints for one server: the declaration, and what it actually did.
McpSettings
How MCP servers are started in this process, when [[mcp]] entries do not say. None — --no-mcp — starts none of them at all: no process, no tools, and no problem entries for servers that would have failed anyway.
Plugin
A plugin that loaded: its manifest plus where it lives.
PluginTool
What Plugins::tools produces: tools to register, and the reasons some were rejected. One tool a plugin offers, with the policy it asked for and the plugin to blame or credit.
Plugins
Everything that loaded, and everything that did not (with the reason).
ProfileDef
PromptDef
RequestDef
[provider_profile.request]: what this backend wants on every request, whatever the turn asks.
ToolDef

Enums§

Cwd
Working directory for a plugin command, and for an MCP server config.toml declares — which is why it serializes: the spec carrying it round-trips through config show (#352).
Event
Kind
How a plugin tool gets its arguments, and what runs it.
ModelReasoningDef
A model’s own reasoning entry: reasoning = false (it does not think), or a policy of its own.
Parameters
Where a tool’s JSON Schema comes from.
TemperatureDef
temperature = "omit" or temperature = { fixed = 0.2 }.
Verdict
What a before_tool hook decided.

Constants§

API
Manifest API version this build speaks. A plugin asking for a newer one is not loaded.
DEFAULT_TIMEOUT
Default timeout for a plugin tool or hook; a manifest may lower it.
MANIFEST
Manifest file name inside a plugin directory.
MAX_MANIFEST_FILE_BYTES
The largest a plugin-authored file may be, matching the line skills.rs draws for SKILL.md: a prompt is paid for on every request, so a 5 MB prompts/*.md crowds out the conversation it was meant to steer.
MAX_TIMEOUT
Hard ceiling: no manifest may make the agent wait longer than this.

Functions§

discover_all
Every directory that has a manifest, whether or not it is enabled, in search order. Used by eclipse plugins list so a plugin you forgot to enable is still visible.
load
Discover and load plugins from dirs, in order: the first plugin with a given name wins (so a profile’s copy shadows the shared one). Only names in enabled are considered, except a manifest that declares nothing but provider profiles (see [declares_only_profiles]). A missing manifest, a manifest that does not parse, a name that does not match its directory, or a newer api becomes a problem entry, never an error.
mcp_timeout
The ceiling for an MCP server that states no timeout_secs of its own. [plugins] mcp_timeout_secs is the machine-wide answer; the plugin default (and its clamp) applies when the config says nothing.
profile_from_def
One manifest entry as the profile the provider runs on. Public because the tests that check what the shipped manifests promise read them from plugins/ and must go through the same conversion — a test that reimplements it would be testing itself.

Type Aliases§

ToolsAndProblems