Core Concepts
Actions
Add app-only backing tools your View calls without exposing them to the model.
Actions are backing tools the View can call. They are hidden from the model.
defineAction is defineTool with visibility: ["app"]. Same options as Tools.
import { z } from "zod";
import { defineAction } from "bitmcp";
export const refresh = defineAction({
description: "Reload forecast points",
input: z.object({ city: z.string() }),
async execute({ city }) {
return {
city,
summary: `Updated forecast for ${city}`,
points: [
{ t: "Mon", temp: 70 },
{ t: "Tue", temp: 74 },
{ t: "Wed", temp: 71 },
],
};
},
});Naming
get-forecast/
tool.ts
view.tsx
actions.ts export const refresh = defineAction(...)Registered name: get-forecast.refresh.
From the View
callTool("get-forecast.refresh", { city: result.city });Each call is a new stateless tools/call. Pass handles or ids explicitly when resuming work.