defineTool. Its name must match ^[a-z][a-z0-9_]*$ and an agent must list that exact name in allowedTools.
create_invoice.ts
execute returns a string or a ToolResult.
Execution context
There are no ambient platform credentials. Custom tools read external secrets through
ctx.connections; tokens are resolved server-side from project Connections and injected only for the tool call.
Dependencies and bundling
Cloud detects imported npm packages, installs them with lifecycle scripts disabled, and bundles the tool with esbuild for Node 22. Pure JavaScript dependencies are supported. Native addons containing.node binaries or binding.gyp are rejected; choose a pure JavaScript alternative.
@polpo-ai/tools and @sinclair/typebox are runtime externals and do not need to be bundled.
Manage tools
polpo deploy also synchronizes .polpo/tools/*.ts.
The Agent API exposes the same registry: