Give agents your app's own diagnostics and actions
Expose focused Cordova/Capacitor app data and operations so agents can answer questions the built-in tools cannot.
Custom tools let an agent ask your JavaScript app code for a precise answer, such as the current user or an app-specific state snapshot. Expose small, structured results and only the development actions your workflow needs.
const registration = Ansight.registerTool(
{
id: "app.get_state",
name: "Get app state",
category: "app",
policy: "read",
},
async () => ({
success: true,
result: { ready: true },
}),
);
await registration.ready;
await registration.unregister();
Use stable ids, structured inputs and results, an explicit read, write, or
critical policy, and the least-permissive tool guard. Prefer a small
app-specific tool over broad DOM actions or native reflection when the app can
provide a precise answer.
Native tool entries report dynamic runtime availability and remediation through the shared catalog. JavaScript-backed custom tools are advertised as available while registered; when one becomes unusable, unregister it or return a stable failure errorCode from the handler. The Capacitor registration API does not currently expose a pre-invocation availability callback.