pi.registerTool({
  name,
  label,
  description,
  parameters,
  execute,
});

Definition

FieldTypeRequirement
namestringRequired; matches [a-zA-Z0-9_-]{1,64}
labelstringOptional display label
descriptionstringRequired and non-empty
parametersobjectRequired JSON-Schema-like parameter definition
executeasync functionRequired at hosted execution time
Manifest discovery records name, label, description, and parameters. The function body executes only in the hosted extension host.

Execute signature

async execute(toolCallId, params, signal, onUpdate, ctx) {
  return {
    content: [{ type: 'text', text: 'result' }],
    details: { optional: 'metadata' },
  };
}
signal and onUpdate are reserved arguments and may currently be undefined. ctx.external contains bounded integration metadata or null.

Limits

  • Up to 64 extension entrypoints per manifest.
  • Up to 256 declared tools per extension.
  • Tool names must be unique in the compiled tool surface.
  • Tool execution has a 60-second hosted timeout.
See tool result format and the custom tool tutorial.