Appearance
add-toolbox-api
This skill automates adding window.toolboxAPI calls to a PPTB tool — the platform-level API almost every tool reaches for first, since Dataverse and Power Platform calls need to know which connection to use. A developer reaches for it whenever the tool needs to read the active connection, show a notification, manage a terminal session, or launch/receive data from another tool.
Every ToolBox API call this skill generates is awaited, and any call scoped to a specific connection includes an explicit connectionTarget: 'primary' | 'secondary' argument whenever the tool supports a secondary connection — the parameter defaults to 'primary' but multi-connection tools must not rely on the default when secondary access is intended.
When to use it
- "Get the active Dataverse connection in my tool"
- "Show a notification when this operation finishes"
- "Copy this data to the clipboard"
- "Add support for a secondary connection"
- "Create a terminal session in my tool" / "run a build command from my tool"
- "Let this tool launch another tool and get a result back"
- "Read the launch context this tool was started with"
- "Open this record in the user's browser"
Inputs
- Which capability the tool needs: connections, utils (notification/clipboard/theme/parallel/browser), terminal, invocation, or tool context
- Whether the tool needs
multiConnectionsupport ("optional"or"required") — determines whether generated calls passconnectionTarget - For invocation: the target tool's npm package name (
toolId) and the shape of prefill/return data - For terminal: working directory, environment variables, and whether the panel should be visible
What it does
- Adds
await toolboxAPI.connections.getActiveConnection()(andgetSecondaryConnection()when multi-connection is enabled) wherever the tool needs connection metadata (Connection.name,.environment,.url,.enabledForPowerPlatformAPI,.scopesForPowerPlatformAPI). - Wires
toolboxAPI.utils.showNotification({ title, body, type, duration })around operation completion/failure points, usingtype: 'info' | 'success' | 'warning' | 'error'. - Adds
toolboxAPI.utils.copyToClipboard(text),toolboxAPI.utils.getCurrentTheme(),toolboxAPI.utils.executeParallel(...), andtoolboxAPI.utils.openInConnectionBrowser(url, connectionTarget?)calls as requested, keepingopenInConnectionBrowserrestricted tohttps:/http:URLs. - Wires terminal lifecycle calls —
toolboxAPI.terminal.create(options),.execute(terminalId, command),.setVisibility(terminalId, visible),.list(),.close(terminalId). - For inter-tool workflows, adds
toolboxAPI.invocation.launchTool(targetToolId, prefillData?, options?)on the caller side, andtoolboxAPI.invocation.getLaunchContext()/toolboxAPI.invocation.returnData(returnData)on the launched-tool side. - Adds
toolboxAPI.getToolContext()where the tool needs itstoolId,instanceId,connectionUrl, orsecondaryConnectionUrlwithout needing access tokens. - When a generated call requires
multiConnection, adds or updatesfeatures.multiConnectioninpackage.json, and setsfeatures.minAPIto at least the highest Requires vX.Y.Z badge among the methods used (for example1.2.0forgetActiveConnection/getSecondaryConnection,1.2.2foropenInConnectionBrowser,1.2.2-betafor the invocation API). - Flags any use of the deprecated
saveFile()/selectPath()utils and rewrites them against the File System API instead.
Example
Before: a tool with no connection awareness.
After:
typescript
const connection = await toolboxAPI.connections.getActiveConnection()
if (connection) {
await toolboxAPI.utils.showNotification({
title: 'Connected',
body: `Using ${connection.name} (${connection.environment})`,
type: 'info',
duration: 3000,
})
} else {
await toolboxAPI.utils.showNotification({
title: 'No connection',
body: 'Select a connection to continue.',
type: 'warning',
duration: 0,
})
}package.json gains, if a secondary connection is used elsewhere in the tool:
json
"features": {
"multiConnection": "optional",
"minAPI": "1.2.0"
}Checklist it enforces
- [ ] Every ToolBox API call is
awaited and wrapped in error handling. - [ ] Multi-connection tools declare
features.multiConnection("optional"or"required") inpackage.json. - [ ] Calls that need the secondary connection explicitly pass
'secondary'asconnectionTarget. - [ ]
package.json'sfeatures.minAPIcovers the highest Requires vX.Y.Z badge among the ToolBox API methods called. - [ ] No remaining calls to the deprecated
saveFile()/selectPath()utils — migrated to the File System API.
Related
- ToolBox API — the API reference this skill is built on
- Related skills:
../add-dataverse-api/,../add-inter-tool-invocation/