Skip to main content

Tools API

Info

App Bridge isn't versioned with Polaris. App Bridge APIs and web components are identical in every App Home reference version.

The Tools API enables apps to register handler functions for the platform to invoke on behalf of the app.

Tools must be pre-declared statically in a json schema file linked in a Sidekick app extension's shopify.extension.toml. The platform discovers available tools from these schemas. At runtime, shopify.tools.register(name, handler) binds a live handler that executes inside the sandbox. Registered tools persist for the lifetime of the extension or until explicitly removed.

  • In-app modifications: Enable merchants to ask Sidekick to make changes in your app, such as rescheduling a shipment, pausing a subscription, or updating a design with natural language.
  • AI-powered workflows: Expose executable tools that Sidekick can invoke on behalf of merchants.

MethodTypeDescription
registerRegisterFunctionRegisters a tool for this app. If a tool with the same name is already registered, the existing handler is replaced.
unregisterUnregisterFunctionUnregisters a tool this app has previously registered. If no tool with the given name exists, this is a no-op.
clearClearFunctionRemoves all tools registered by this app.

ParameterTypeDescription
namestringA unique name for the tool within this app.
handlerToolHandlerThe function invoked when the platform calls this tool.

Returns: () => void — A cleanup function that unregisters the tool. Equivalent to calling unregister with the same name.

Anchor to [object Object]UnregisterFunction

ParameterTypeDescription
namestringThe name of the tool to unregister.

Removes all tools registered by this app. Takes no parameters.

A handler function invoked by the platform when a registered tool is called. The handler receives an input object whose shape is defined by the tool's schema, and must return a result object (or a Promise that resolves to one).

ParameterTypeDescription
inputRecord<string, any>The input parameters provided by the caller.

Returns: Record<string, any> | Promise<Record<string, any>> — The result of the tool invocation.

Examples

js

shopify.tools.register('list_email_campaigns', async (input) => {
const {status, limit = 10} = input;

const campaigns = await fetchCampaigns({status, limit});

return {campaigns};
});

Was this page helpful?