Agent tools
PreviewPreview. Tile tools are in the preview: opening a tile and showing content in it (SDK phase 2), and reading a tile back and acting outside it with your approval (phase 3).
An extension gives your agents tools of its own, and Pitwall registers them with every agent it starts, through the MCP server it already gives them. You set up nothing in any agent. The first such tool opens the tile: an agent can open your tile next to its own terminal with content in it ("draft that as a note", "show me the diagram on the right"), the way it opens files and web pages in Pitwall with show_files and show_web.
- Every tile can be opened
- Show tools of your own
- Where it opens
- Limits
- How agents get them
- What you control
- Testing them
- Reading and acting
- Undo, appends and files
- Commands for the shell and the palette
- A skill for agents
Every tile can be opened
Pitwall offers <extension-id>__open for every extension with tiles, with no code from you. It takes the tile's declared "input" schema as content; without one, it opens the tile as it was.
{ "id": "main", "title": "Notes", "wasm": "tile.wasm", "world": "pitwall:tile@0.1.0", "input": "input.schema.json" }
The schema is what agents read to decide what to send, so give it a description and describe each property. The tile reads the content in on_content with Content::parse (Tiles and UI components), the same way it reads content you open it with. A tile entry with "agents": false can't be opened by agents and has no tools.
An extension with several tiles gets one __open that takes tile (which one) and content.
Show tools of your own
An extension may declare up to 16 tools, of four kinds:
| Kind | Does | Who decides | Example |
|---|---|---|---|
show | Opens or focuses the tile, maybe at something | Allowed | show_issue: an issue number in, the list scrolled to it |
present | Puts content into the tile, or changes content the same agent put there | Allowed: marked with the agent, and you can Undo it | show_diagram: Mermaid source in, a diagram on screen |
read | Returns what the tile has now, including your edits | You: asked the first time, then "Always" for that agent if you choose | current_diagram |
act | Has effects outside the tile: the network, files, other services | You, each call, unless you chose "Always" for that agent | export_svg |
Declare each in the tile's entry in extension.json, with a JSON schema for its input:
"tools": [
{
"name": "show_message",
"kind": "present",
"description": "Show a short message under the agent's item id (the same item again replaces it).",
"input": {
"type": "object",
"required": ["message"],
"properties": {
"item": { "type": "string", "description": "Your id for the message" },
"message": { "type": "string", "maxLength": 200, "description": "The message" }
}
}
}
]
A name is lowercase letters, digits and _, at most 32, and not open. With the extension's id it must fit in 50 characters (notes__show_message), which pitwall extension check tells you. The input is a JSON object; where and of are Pitwall's own, so you can't use them. The schema can use type, properties, required, additionalProperties, enum, items, minLength, maxLength, minItems, maxItems, minimum, maximum and description.
Then write each one as a method in a #[tools] block, named after the tool:
use pitwall_extension::prelude::*;
use pitwall_extension::tools;
use pitwall_extension::tools::{Call, Problem, Reply, ToolError};
#[derive(serde::Deserialize)]
struct Message { message: String }
#[tools]
impl Hello {
#[tool(kind = "present")]
fn show_message(&mut self, call: Call<Message>, cx: &mut Cx<Self>) -> Result<Reply, ToolError> {
let text = call.input().message.trim().to_string();
if text.is_empty() {
return Err(ToolError::problems("Nothing was shown: the message is empty.", [Problem::new("`message` has no text")]));
}
self.messages.insert(call.key(), text); // `<agent-id>/<item>`: one per agent and item
cx.notify();
Ok(Reply::text("Shown"))
}
}
pitwall_extension::export! finds the #[tools] block itself. The method gets the call's input read into your type, and call.item(), call.caller() (the agent's id, name and project), call.view() and call.key(). The kinds in code and in the manifest must match.
- The reply is what the agent reads: a short
Reply::text, withReply::jsonfor a result and.item(…)when your tile picked the item id. Without a#[tools]method (the host's__open), Pitwall tells the agent where the tile opened. - Errors change nothing. Return
ToolError::plainorToolError::problemswithProblem::at(line, column, …)for each problem in the input (a Mermaid syntax error at line 3). The agent reads them and can fix its call. Show nothing new when you return an error. - Items. The content's id is the agent's item id: a later call with the same item updates it in place, a new item adds one. Items are per agent, so two agents' item "a" are two items.
- The user's edits are safe. When the user edits something an agent showed, call
tools::user_edited(call.origin())(or with thecallof the content it came in). From then on Pitwall refuses that agent's calls for that item, before your tile sees them, and tells the agent to show its version under a new item.
__open content and a declared tool's call both arrive as view content: on_view_opened and then the content when the view wasn't open, or only the content when it was. Content::from_agent(), call(), tool() and caller() say which call, tool and agent it came from. For __open, on_content gets it; for a declared tool, your method does.
An example: the C4 tile's c4__show
The C4 diagrams tile has one present tool. An agent sends Mermaid and the tile draws it; the same item again updates the drawing in place. Its extension.json; the description tells agents the convention:
The pinned manifest and input validation and presentation implementation are in C4’s standalone source repository. Its input is read completely before an update; a problem returns every error with its line and changes nothing.
An agent's call, as Claude Code makes it (mcp__pitwall__c4__show):
{ "item": "containers", "title": "Shop containers", "where": "right", "mermaid": "flowchart LR\n buyer[\"Buyer [Person]\"]\n subgraph shop[\"Shop [Software System]\"]\n web[\"Web app [Container]\"]\n api[\"Orders API [Container]\"]\n end\n buyer -->|uses| web\n web -->|calls| api\n" }
The reply: Showing “Shop containers” in the C4 tile (item “containers”): 3 boxes, 2 arrows, 1 boundary. A later call with "item": "containers" answers Updated “Shop containers” in place … with what changed since the last show.
Where it opens
Next to the calling agent's terminal, on the right by default, as show_web places a web page. Pitwall adds where (right, left, above, below, replace or window) and of (another agent's terminal) to every tile tool. A tile already in the layout is reused wherever you moved it; with where it moves there. A window of its own never comes in front of your work or takes the keyboard. When the agent's terminal isn't in any open window, the tile opens in a window of its own and the agent is told why.
Pitwall marks the tile with "from <agent>" while it shows what that agent put in it; pressing the mark goes to the agent's terminal.
Limits
- 1 MiB of JSON input per call; larger is refused.
- 10 seconds per call, from Pitwall handing it over to the tile's answer.
- 10 calls in 10 seconds per agent and tile ("Busy" after that).
- A reply's text is cut at 4 KiB and its JSON dropped over 256 KiB.
- Pitwall checks the input against the tool's schema before the tile sees it, and answers a bad one itself, naming each problem (`
messageis required`).
How agents get them
- Through Pitwall's MCP server.
pitwall mcpalready gives the agents Pitwall startsshow_files,show_weband the rest. Tile tools join that list, and agents are told when it changes (notifications/tools/list_changed: an extension or a switch turned on or off, an extension installed or updated). - Every agent Pitwall starts with that server. Pitwall adds it to each agent kind in the kind's own launch-time way, without editing your config files (Showing files). So Claude Code, Codex and the others get tile tools with no setup.
- Names. A tool is named
<extension-id>__<tool>, such asnotes__openandhello__show_message. Claude Code shows it asmcp__pitwall__notes__open. - Hints and allow lists.
show,presentandreadtools carry MCP's read-only hint. Anacttool doesn't, and carriesdestructiveHintandidempotentHintas its manifest says ("destructive": false,"idempotent": true; MCP's defaults, destructive and not idempotent, when it says nothing). Claude Code and Qwen Code get theshowandpresenttools in the allow lists Pitwall passes at launch, besideshow_files;readandacttools are never in them, and Pitwall asks you about those itself. A tool added after an agent started is offered to it but may ask once. - Their description. Pitwall puts "<Extension name> (a Pitwall tile):" before each tool's description, and adds one line per extension to the server's instructions.
- Only agents Pitwall started can put content in a tile (
present) or callreadandacttools.showand__openalso work from a shell an agent runs, asshow_filesdoes.
What you control
- A switch per tile, "Agents can use <name>", on the extension's card in Settings → Extensions, with the tool names. Off removes its tools from every agent's list at once.
- A switch for all tiles, "Agents can use tiles" in Settings → Agents (
agents.tileTools), beside "Agents can show you files". It lists the tools agents get now. - The permission screen lists a tile's tools under "Adds to Pitwall" before you turn the extension on.
- Activity. Each call is in the extension's Activity on its card: when, which agent, which tool and item, the start of the input, and whether it was shown or why not.
Testing them
The harness calls a tool as an agent would, through the same checks:
use pitwall_extension_test::{Called, Harness};
let mut tile = Harness::build(env!("CARGO_MANIFEST_DIR")).open("main");
let r = tile.call("claude", Some("show_message"), Some("a"), json!({ "message": "hi" }));
assert_eq!(r, Called::Replied { text: "Shown".into(), json: None, item: None });
assert!(tile.call("claude", Some("show_message"), Some("b"), json!({})).text().contains("`message` is required"));
assert!(tile.call("claude", None, Some("a"), json!({ "message": "hi" })).is_ok()); // `<id>__open`
None as the tool is __open. The result is Called::Shown, Replied, Failed (your error), Refused (Pitwall's: the schema, an edited item, the rate, a denial) or Waiting (a read or act call answered later).
read and act calls go through the user's approval as in Pitwall. Set what the user answers, and see what they were asked:
use pitwall_extension_test::Approval;
tile.approve(Approval::Deny);
assert!(tile.call("claude", Some("current_messages"), None, json!({})).text().contains("denied"));
tile.approve(Approval::Always); // "Always for claude": no question next time
let r = tile.call("claude", Some("current_messages"), None, json!({}));
assert!(r.json().is_some());
tile.run_command("send_message", json!({ "text": "hi" })); // the user, from a plain terminal
assert_eq!(tile.approvals_asked().len(), 3);
tile.undo(tile.last_call().unwrap()); // Undo beside the mark
call_append and call_from_file make a present call with "mode": "append" or a named file; cancel_call runs a call out of time.
Reading and acting
A read tool returns data, an act tool changes something outside the tile. Declare them like the others, with the kind, and for act its MCP hints:
{ "name": "current_messages", "kind": "read", "description": "The messages Hello shows now, with the user's edits, as JSON by item." },
{ "name": "send_message", "kind": "act", "description": "Send a message.", "destructive": false, "idempotent": false,
"input": { "type": "object", "required": ["text"], "properties": { "text": { "type": "string" } } } }
#[tool(kind = "read")]
fn current_messages(&mut self, _call: Call<Empty>, _cx: &mut Cx<Self>) -> Result<Reply, ToolError> {
let all: BTreeMap<_, _> = self.messages.iter().map(|(k, v)| (k.clone(), v.clone())).collect();
Reply::json(format!("{} messages", all.len()), &all)
}
- The user approves, in Pitwall. The approval dialog names the agent, its project, the tool and its arguments, with Deny, Always for <agent> and Allow once. When you aren't in Pitwall, the same request is a card in the floating control, with the same three answers; answered in one place, it goes from the other.
A read asks until the user chooses "Always" for that agent; an act asks each time unless they did. "Always" is kept per extension, agent and tool, listed on the extension's card and in Settings → Agents, each with Revoke. A tile that holds agents.queue or agents.start gets no "Always" for its act tools: those ask every time. Unanswered in 2 minutes counts as a denial; a denied call changes nothing.
- The user's own calls. From a plain Pitwall terminal (
pitwall extension run), areadruns without asking; anactstill asks, without "Always", so a script can't act behind their back. From outside Pitwall onlyshowtools run. - Answer later. Return
Reply::later()and reply withtools::reply(call_id, …)when the work is done (a request to a service, say). Past the time limit (read10 seconds,act2 minutes after the approval) the agent hears it timed out and your tile getsEvent::ToolCancelled(call). - Without acting permissions. During a
show,presentorreadcall the tile's acting permissions (net, its own server,show,notify,agents.queue,agents.start,agents.focus) are off; anactcall has them all. So a tool's kind can't be a lie. - Output. Up to 256 KiB of text or JSON; more is cut and says so. A
readtool should take a range or a cursor. - Records. Each call is in the extension's Activity: the agent, the tool, the input (all of it for
act) and how it ended.
Undo, appends and files
- Undo. Next to the "from <agent>" mark, Undo takes back the agent's last
presentcall: your tile getsEvent::UndoPresent(call). Keep presented items inPresented<T>and it restores the value from before that call (or removes an item the call added) for you:present(&call, value),append(&call, |v| …),edit_by_user(key, value),undo(call). - Appends. A
presenttool takes"mode": "append"with anitem: what it gives adds to that item (Content::is_append(),Call::is_append()). Appends close together are drawn at most four times a second. - Large input from a file. Instead of inline text, a
presentcall can name"from_file": "docs/flow.mmd", a file in the calling agent's project (relative, inside it, at most 16 MiB, UTF-8). Your tile reads it withcall.large_input()(in parts of up to 1 MiB, joined for you). Nofiles.readpermission is needed: the agent chose a file of its own.
Commands for the shell and the palette
A tool is also a command. expose says where it is offered: agents (their MCP tools), cli (pitwall extension run) and palette (the command palette); the default is ["agents", "cli"]. palette needs a title, at most 60 characters, and an input of plain properties (strings, numbers, booleans, enums):
{ "name": "send_message", "kind": "act", "expose": ["agents", "cli", "palette"], "title": "Send a message", … }
pitwall extension tools hello # what agents get
pitwall extension commands hello # what `run` takes, with arguments
pitwall extension run hello send_message -- --text "Release 0.9 is out"
pitwall extension run hello current_messages --human
echo '{"text":"hi"}' | pitwall extension call hello send_message --input -
run prints the result's JSON (its text with --human); problems go to stderr. Exit status: 0 ok, 1 the tile answered with an error, 2 bad arguments, 3 refused or denied, 4 not available (Pitwall, the extension or the tile isn't there or on), 5 timed out. --timeout <seconds> may only shorten a tool's time.
In the palette each palette tool is "<Extension>: <title>", run as yours, without asking. One that needs input reads "<Extension>: <title>…" and opens a small form first: a field per property of its input, labelled from the property's name, with its description under it and a red mark on required ones. Strings are text fields (maxLength kept), numbers and integers are checked as you run, booleans are a checkbox, and an enum is a row of choices (a dropdown past four). Run (↵) sends it; Esc or Cancel closes. A tool whose input has anything else (a nested object, an array) isn't in the palette.

A skill for agents
Tools say what a tile can do; a skill tells agents when to use them. Put one in your package as agents/SKILL.md:
---
name: hello
description: Show short messages to the user in Pitwall's Hello tile.
---
When the user asks to see a message next to your terminal, call
`hello__show_message` with an `item` id you reuse for later changes.
Call `hello__send_message` only when the user asks you to send one.
- Limits. Text only, at most 16 KiB;
nameis your extension's id (or left out); it may name only your own tools (<id>__…).pitwall extension checksays what is wrong. - You choose the projects. On the extension's card in Settings → Extensions, under Skill for agents, tick the projects whose agents get it. It is kept in Pitwall, never written into a project's tracked files.
- Agents get it with their rules. Pitwall gives it to them the way it gives the skills in Settings → Rules & skills: through rulesync, into each agent's own folder (
.claude/skills/hello/for Claude Code,.agents/skills/hello/for Codex, …), kept out of git. It starts with a line saying it is the Hello tile's. A new agent gets it when it starts; one already running shows "rules changed" until Re-apply & restart. Settings → Rules & skills lists it for each agent as "from Hello (a tile)". - Off is off. Turning the extension off, or its tile's "Agents can use <name>", or unticking a project, takes it away at the next apply.
- Agents without skills (Gemini CLI, Aider) get its
descriptionin Pitwall's MCP server instructions instead.