=============== LIBRARY RULES =============== From library maintainers: - Don't hand-edit the generated API client in `common/api/generated`. Run `pnpm run generate-client` to regenerate it from the ToolHive OpenAPI spec. - To test a custom `thv` build in development, run `thv serve --openapi --socket=`, then `THV_SOCKET= pnpm run start`. Packaged builds ignore `THV_SOCKET`. - For ToolHive CLI, Kubernetes operator, and vMCP usage, see the ToolHive documentation at docs.stacklok.com/toolhive. ### Start development server with pnpm Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Starts the Electron application with hot reload for the renderer process. ```bash pnpm run start ``` -------------------------------- ### Example deep link URLs Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/deep-links.md Sample deep link URLs demonstrating the format for registry server detail and skill install intents. ```text toolhive-gui://v1/open-registry-server-detail?serverName=playwright-mcp toolhive-gui://v1/open-registry-skill-install?namespace=stacklok&skillName=create-python-app&version=v1.2.0 ``` -------------------------------- ### Example deep links Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Example deep links showing the format for opening registry server details. ```text toolhive-gui://v1/open-registry-server-detail?serverName=fetch toolhive-gui://v1/open-registry-server-detail?serverName=time ``` -------------------------------- ### Start custom thv binary with --socket (macOS/Linux) Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Run your custom thv binary manually with the same --socket flag the studio uses internally. This is required before setting THV_SOCKET and starting the dev server. ```bash thv serve \ --openapi \ --socket=/tmp/thv-dev.sock ``` -------------------------------- ### Set THV_SOCKET and start dev server (macOS/Linux) Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Set the THV_SOCKET environment variable to the socket path used by your custom thv binary, then start the dev server with pnpm start. The UI will display a banner with the socket path when THV_SOCKET is set. ```bash THV_SOCKET=/tmp/thv-dev.sock pnpm start ``` -------------------------------- ### POST /api/v1beta/plugins Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Installs a plugin using the provided installation request. Returns the installation response. ```APIDOC ## POST /api/v1beta/plugins ### Description Installs a plugin using the provided installation request. ### Method POST ### Endpoint /api/v1beta/plugins ### Parameters #### Request Body - **installPluginRequest** (object) - Required - The plugin installation request. ### Response #### Success Response (201) - **installPluginResponse** - The installation response. #### Error Responses - **400** - Bad request. - **401** - Unauthorized. - **403** - Forbidden (signature/trust). - **404** - Not found. - **409** - Conflict. - **429** - Too many requests. - **500** - Internal server error. - **502** - Bad gateway. - **504** - Gateway timeout. ``` -------------------------------- ### Install dependencies with pnpm Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Run this command to install all project dependencies. Requires pnpm and a Node.js version manager like nvm or fnm; the required Node version is in .nvmrc. Docker daemon must be running. ```bash pnpm install ``` -------------------------------- ### Set THV_SOCKET and start dev server (Windows PowerShell) Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Set the THV_SOCKET environment variable to the named pipe path used by your custom thv binary, then start the dev server with pnpm start. The UI will display a banner with the pipe path when THV_SOCKET is set. ```powershell $env:THV_SOCKET = '\\.\pipe\thv-dev'; pnpm start ``` -------------------------------- ### Example: start a chat stream and listen for errors Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-api.md Shows how to call `window.electronAPI.chat.stream` with a ChatRequest and subscribe to `chat:stream:error` events. The error handler checks the `streamId` and unsubscribes after handling the error. ```typescript const request = { chatId: 'thread_1720000000000_abc123', messages: [{ role: 'user', parts: [{ type: 'text', text: 'List the servers' }] }], provider: 'openai', model: 'gpt-5', apiKey: 'sk-...', enabledTools: ['server-a.tool_x'], agentId: 'builtin.toolhive-assistant', } const { streamId } = await window.electronAPI.chat.stream(request) const off = window.electronAPI.on('chat:stream:error', (_e, err) => { if (err.streamId === streamId) { /* toast err.error */ off() } }) ``` -------------------------------- ### llmGateway.ensureStarted Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-api.md Ensures the LLM Gateway proxy is started. Returns the result of the start operation. ```APIDOC ## llmGateway.ensureStarted ### Description Ensures the LLM Gateway proxy is started. Returns the result of the start operation. ### Method Promise ### Returns - **EnsureStartedResult** - The result of the start operation (see types.md for details). ### Example ```ts const result = await window.electronAPI.chat.llmGateway.ensureStarted() ``` ``` -------------------------------- ### installUpdateAndRestart Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/auto-update.md Installs the downloaded update and restarts the application. Returns a success flag. ```APIDOC ## installUpdateAndRestart ### Description Installs the downloaded update and restarts the application. Returns a success flag. ### Method IPC (invoke) ### Channel `install-update-and-restart` ### Parameters None ### Response #### Success Response - **success** (boolean) - Whether the update installation and restart were initiated successfully. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Run thv binary with pnpm Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Run this command once to build the application before starting the development server. It runs the same thv binary that the dev server uses. ```bash pnpm thv ``` -------------------------------- ### POST /api/v1beta/skills Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Installs a skill. Requires an installSkillRequest body. ```APIDOC ## POST /api/v1beta/skills ### Description Installs a skill. ### Method POST ### Endpoint /api/v1beta/skills ### Parameters #### Request Body - **installSkillRequest** (object) - Required - The skill installation request. ### Response #### Success Response (201) - **installSkillResponse** - The installation response. #### Error Responses - **400** - Bad request. - **401** - Unauthorized. - **404** - Not found. - **409** - Conflict. - **429** - Too many requests. - **500** - Internal server error. - **502** - Bad gateway. - **504** - Gateway timeout. ``` -------------------------------- ### GET /api/v1beta/skills/builds Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Lists all skill builds. ```APIDOC ## GET /api/v1beta/skills/builds ### Description Lists all skill builds. ### Method GET ### Endpoint /api/v1beta/skills/builds ### Response #### Success Response (200) - **buildListResponse** - List of builds. #### Error Responses - **500** - Internal server error. ``` -------------------------------- ### Copy branding example to userData (Linux/macOS) Source: https://github.com/stacklok/toolhive-studio/blob/main/branding-examples/README.md Copy a branding JSON file to the userData directory so it is used on a normal launch. Linux uses ~/.config/ToolHive/branding-0.json; macOS uses $HOME/Library/Application Support/ToolHive/branding-0.json. ```bash # Linux cp branding-examples/test-theme.json ~/.config/ToolHive/branding-0.json # macOS cp branding-examples/test-theme.json "$HOME/Library/Application Support/ToolHive/branding-0.json" ``` -------------------------------- ### utilsApi Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/electron-api.md Provides utility methods for checking the official release build, getting telemetry headers, getting the instance ID, and retrieving available tools for a workload. The getWorkloadAvailableTools method connects to the workload's MCP endpoint and lists its tools. ```APIDOC ## utilsApi ### Description Provides utility methods for checking the official release build, getting telemetry headers, getting the instance ID, and retrieving available tools for a workload. The getWorkloadAvailableTools method connects to the workload's MCP endpoint and lists its tools. ### Methods - **isOfficialReleaseBuild** () => Promise - Returns whether the current build is an official release. - **getTelemetryHeaders** () => Promise> - Returns telemetry headers. - **getInstanceId** () => Promise - Returns the instance ID. - **getWorkloadAvailableTools** (workload: CoreWorkload) => Promise } }> | null | undefined> - Retrieves the available tools for the given workload. ``` -------------------------------- ### Open deep link with xdg-open Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Opens a deep link from the browser or command line using xdg-open. The example link opens the registry server detail for serverName=fetch. ```bash xdg-open "toolhive-gui://v1/open-registry-server-detail?serverName=fetch" ``` -------------------------------- ### Start custom thv binary with --socket (Windows PowerShell) Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Run your custom thv binary manually with the same --socket flag on Windows. Use the named pipe path as shown. ```powershell thv.exe serve ` --openapi ` --socket='\\.\pipe\thv-dev' ``` -------------------------------- ### Register Linux deep link protocol handler Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Registers the toolhive-gui:// protocol handler on Linux. Builds a .deb, extracts and installs the .desktop file system-wide. ```bash pnpm run deeplink:registerLinuxTestProtocolHandler ``` -------------------------------- ### Essential pnpm commands for ToolHive Studio development Source: https://github.com/stacklok/toolhive-studio/blob/main/AGENTS.md Run these commands from the repository root. Requires Node.js >=24 <25 and Docker daemon running for `pnpm run start`. Husky/lint-staged automatically run lint and format on staged files; run `pnpm run type-check` manually before committing. ```bash pnpm install # Install dependencies pnpm run start # Start dev server with hot reload pnpm run lint # Run ESLint pnpm run type-check # TypeScript type checking pnpm run format # Format with Prettier pnpm run test:nonInteractive # Run unit tests once pnpm run test:coverage # Unit tests with coverage pnpm run e2e # End-to-end tests pnpm run generate-client # Regenerate API client from OpenAPI spec pnpm run knip # Detect unused code ``` -------------------------------- ### GET /api/v1beta/plugins/builds Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Lists all plugin builds. Returns a list of build responses. ```APIDOC ## GET /api/v1beta/plugins/builds ### Description Lists all plugin builds. ### Method GET ### Endpoint /api/v1beta/plugins/builds ### Response #### Success Response (200) - **pluginBuildListResponse** - The list of plugin builds. #### Error Responses - **500** - Internal server error. ``` -------------------------------- ### Check container engine availability Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/toolhive-manager.md Use window.electronAPI.checkContainerEngine to detect whether Docker, Podman, or Rancher Desktop is available. If engine.available is false, show an onboarding prompt to install Docker or Podman. ```TypeScript // Error handling: container engine missing const engine = await window.electronAPI.checkContainerEngine() if (!engine.available) { // show "install Docker / Podman" onboarding } ``` -------------------------------- ### GET /api/v1beta/workloads/upgrade-check Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Checks for upgrades for multiple workloads. ```APIDOC ## GET /api/v1beta/workloads/upgrade-check ### Description Checks for upgrades for multiple workloads. ### Method GET ### Endpoint /api/v1beta/workloads/upgrade-check ### Parameters #### Query Parameters - **all** (boolean) - Optional - If true, checks all workloads. - **group** (string) - Optional - Filter by group name. ### Response #### Success Response (200) - **body** (upgradeCheckBulkResponse) - Upgrade check results. #### Response Example ```json {} ``` ### Error Handling - **400** - Invalid request. - **404** - Workload or group not found. ``` -------------------------------- ### GET /api/v1beta/clients Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves a list of clients. ```APIDOC ## GET /api/v1beta/clients ### Description Retrieves a list of clients. ### Method GET ### Endpoint /api/v1beta/clients ### Response #### Success Response (200) - **body** (list) - List of clients. #### Response Example ```json [] ``` ``` -------------------------------- ### threadSettings.getEnabledMcpTools Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-api.md Gets the enabled MCP tools for a thread. ```APIDOC ## threadSettings.getEnabledMcpTools ### Description Gets the enabled MCP tools for a thread. ### Method getEnabledMcpTools ### Parameters #### Path Parameters - **threadId** (string) - Required - The thread ID. ### Response #### Success Response - **Promise>** - A record mapping server names to arrays of tool names. ``` -------------------------------- ### Consumer pattern: reading a setting Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/database.md Example of reading a setting from the database in the main process. Imports getDb and readSetting, then reads 'isTelemetryEnabled' which returns 'true', 'false', or undefined. ```typescript // main process import { getDb } from './db/database' import { readSetting } from './db/readers/settings-reader' const value = readSetting('isTelemetryEnabled') // 'true' | 'false' | undefined ``` -------------------------------- ### POST /api/v1beta/secrets Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Sets up secrets for the default provider. Returns a 201 response with the setup secrets response on success, or 400/500 on error. ```APIDOC ## [POST] /api/v1beta/secrets ### Description Sets up secrets for the default provider. ### Method POST ### Endpoint /api/v1beta/secrets ### Parameters #### Request Body - **setupSecretsRequest** (pkg_api_v1.setupSecretsRequest) - Required - The request body for setting up secrets. ### Response #### Success Response (201) - **setupSecretsResponse** (pkg_api_v1.setupSecretsResponse) - The response containing the setup secrets result. #### Error Responses - **400** - Bad request - **500** - Internal server error ``` -------------------------------- ### Using onDeepLinkNavigation with unsubscribe Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/electron-api.md Example of subscribing to deep link navigation and later unsubscribing using the returned off function. ```TypeScript const off = window.electronAPI.onDeepLinkNavigation((target) => { router.navigate({ to: target.to, params: target.params, search: target.search }) }) // later off() ``` -------------------------------- ### GET /api/v1beta/workloads/{name}/export Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Exports the run configuration of a workload. ```APIDOC ## GET /api/v1beta/workloads/{name}/export ### Description Exports the run configuration of a workload. ### Method GET ### Endpoint /api/v1beta/workloads/{name}/export ### Parameters #### Path Parameters - **name** (string) - Required - The name of the workload. ### Response #### Success Response (200) - **body** (github_com_stacklok_toolhive_pkg_runner.RunConfig) - The run configuration. #### Response Example ```json {} ``` ### Error Handling - **404** - Workload not found. ``` -------------------------------- ### getEnabledSkills Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-api.md Returns the list of enabled skills, optionally filtered by installed names. ```APIDOC ## getEnabledSkills ### Description Returns the list of enabled skills, optionally filtered by installed names. ### Method Function call ### Signature `getEnabledSkills: (installedNames?: readonly string[]) => Promise` ### Parameters - **installedNames** (readonly string[]) - Optional - The list of installed skill names to filter by. ### Returns - **Promise** - An array of enabled skill names. ``` -------------------------------- ### GET /api/v1beta/plugins/content Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves plugin content by OCI reference or local build tag. Returns plugin content. ```APIDOC ## GET /api/v1beta/plugins/content ### Description Retrieves plugin content by OCI reference or local build tag. ### Method GET ### Endpoint /api/v1beta/plugins/content ### Parameters #### Query Parameters - **ref** (string) - Required - OCI reference or local build tag. ### Response #### Success Response (200) - **PluginContent** - The plugin content. #### Error Responses - **400** - Bad request. - **401** - Unauthorized. - **404** - Not found. - **429** - Too many requests. - **500** - Internal server error. - **502** - Bad gateway. - **504** - Gateway timeout. ``` -------------------------------- ### GET /api/v1beta/version Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Returns the version information of the ToolHive API. The response is a `pkg_api_v1.versionResponse` object. ```APIDOC ## GET /api/v1beta/version ### Description Returns the version information of the ToolHive API. The response is a `pkg_api_v1.versionResponse` object. ### Method GET ### Endpoint /api/v1beta/version ### Response #### Success Response (200) - **versionResponse** (object) - Version information ``` -------------------------------- ### GET /api/v1beta/plugins Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Lists plugins based on the provided scope and filters. Returns a plugin list response. ```APIDOC ## GET /api/v1beta/plugins ### Description Lists plugins based on the provided scope and filters. ### Method GET ### Endpoint /api/v1beta/plugins ### Parameters #### Query Parameters - **scope** (string) - Required - Scope of the plugins (`user` or `project`). - **client** (string) - Optional - Client identifier. - **project_root** (string) - Optional - Project root path. - **group** (string) - Optional - Group filter. ### Response #### Success Response (200) - **pluginListResponse** - The list of plugins. #### Error Responses - **500** - Internal server error. ``` -------------------------------- ### GET /api/v1beta/workloads/{name}/upgrade-check Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Checks for upgrades for a single workload. ```APIDOC ## GET /api/v1beta/workloads/{name}/upgrade-check ### Description Checks for upgrades for a single workload. ### Method GET ### Endpoint /api/v1beta/workloads/{name}/upgrade-check ### Parameters #### Path Parameters - **name** (string) - Required - The name of the workload. ### Response #### Success Response (200) - **body** (upgradeCheckResponse) - Upgrade check response. #### Response Example ```json {} ``` ### Error Handling - **400** - Invalid request. - **404** - Workload not found. ``` -------------------------------- ### Persist OpenAI key and read per-thread tool overrides via chat settings API Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-settings.md Renderer usage examples for the chat settings API. The first call persists an OpenAI API key (encrypted at rest) with enabled tools, returning a result object whose `success` flag can be checked to show an error toast. The second call reads per-thread MCP tool overrides for a given thread ID. ```TypeScript // Persist an OpenAI key (encrypted at rest) const res = await window.electronAPI.chat.saveSettings('openai', { apiKey: 'sk-...', enabledTools: ['server-a.tool_x'], }) if (!res.success) toast(res.error) // Read per-thread tool overrides const tools = await window.electronAPI.chat.threadSettings.getEnabledMcpTools(threadId) ``` -------------------------------- ### GET /api/v1beta/plugins/{name} Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves detailed information about a specific plugin by name. Returns plugin info. ```APIDOC ## GET /api/v1beta/plugins/{name} ### Description Retrieves detailed information about a specific plugin by name. ### Method GET ### Endpoint /api/v1beta/plugins/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the plugin. #### Query Parameters - **scope** (string) - Required - Scope of the plugin (`user` or `project`). - **project_root** (string) - Optional - Project root path. ### Response #### Success Response (200) - **github_com_stacklok_toolhive_pkg_plugins.PluginInfo** - Plugin information. #### Error Responses - **400** - Bad request. - **404** - Not found. - **500** - Internal server error. ``` -------------------------------- ### GET /api/v1beta/skills/content Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves skill content by reference. Requires a ref query parameter. ```APIDOC ## GET /api/v1beta/skills/content ### Description Retrieves skill content by reference. ### Method GET ### Endpoint /api/v1beta/skills/content ### Parameters #### Query Parameters - **ref** (string) - Required - The reference identifier. ### Response #### Success Response (200) - **skills.SkillContent** - The skill content. #### Error Responses - **400** - Bad request. - **401** - Unauthorized. - **404** - Not found. - **429** - Too many requests. - **500** - Internal server error. - **502** - Bad gateway. - **504** - Gateway timeout. ``` -------------------------------- ### GET /registry/{registryName}/v0.1/servers/{serverName}/versions/latest Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves the latest version of a server. Returns a v0.ServerJSON object. ```APIDOC ## GET /registry/{registryName}/v0.1/servers/{serverName}/versions/latest ### Description Retrieves the latest version of a server. ### Method GET ### Endpoint /registry/{registryName}/v0.1/servers/{serverName}/versions/latest ### Parameters #### Path Parameters - **registryName** (string) - Required - The name of the registry. - **serverName** (string) - Required - The name of the server. ### Response #### Success Response (200) - **v0.ServerJSON** - The server data. #### Error Responses - **400** - Invalid encoding. - **404** - Server not found. - **500** - Internal server error. - **503** - Service unavailable. ``` -------------------------------- ### Commit message with Signed-off-by trailer Source: https://github.com/stacklok/toolhive-studio/blob/main/DCO.md Example of a commit message that includes the Signed-off-by trailer as required by the DCO. The trailer must be at the bottom of the commit message. ```bash A commit message Closes gh-345 Signed-off-by: jane marmot ``` -------------------------------- ### GET /api/v1beta/skills Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Lists skills, mirroring the plugins surface. Supports filtering by scope, client, project root, and group. ```APIDOC ## GET /api/v1beta/skills ### Description Lists skills, mirroring the plugins surface. ### Method GET ### Endpoint /api/v1beta/skills ### Parameters #### Query Parameters - **scope** (string) - Optional - Filter by scope (`user` or `project`). - **client** (string) - Optional - Client identifier. - **project_root** (string) - Optional - Project root path. - **group** (string) - Optional - Group filter. ### Response #### Success Response (200) - **skillListResponse** - List of skills. #### Error Responses - **500** - Internal server error. ``` -------------------------------- ### GET /api/v1beta/registry/{name}/servers/{serverName} Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves a specific server from a registry. Returns a getServerResponse augmented by V1GetServerResponse. ```APIDOC ## GET /api/v1beta/registry/{name}/servers/{serverName} ### Description Retrieves a specific server from a registry. ### Method GET ### Endpoint /api/v1beta/registry/{name}/servers/{serverName} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the registry. - **serverName** (string) - Required - The name of the server. ### Response #### Success Response (200) - **getServerResponse** - Augmented by V1GetServerResponse. #### Error Responses - **404** - Server not found. ``` -------------------------------- ### isUpdateInProgress Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/auto-update.md Checks whether an update is currently being installed. Returns true while the update state is 'installing'. ```APIDOC ## isUpdateInProgress ### Description Checks whether an update is currently being installed. Returns true while the update state is 'installing'. ### Method IPC (invoke) ### Channel `is-update-in-progress` ### Parameters None ### Response #### Success Response - **boolean** - `true` if an update is in progress, otherwise `false`. #### Response Example ```json true ``` ``` -------------------------------- ### Renderer: Listen for update-downloaded and check update state Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/auto-update.md Use this snippet in the renderer to subscribe to the 'update-downloaded' event and check the current update state. When the state is 'downloaded', show a banner prompting the user to restart and install the update. ```typescript const off = window.electronAPI.onUpdateDownloaded(() => { // rendering layer shows "Restart to update" — calls installUpdateAndRestart() }) const state = await window.electronAPI.getUpdateState() if (state === 'downloaded') updateBanner.visible = true ``` -------------------------------- ### GET /registry/{registryName}/v0.1/x/dev.toolhive/plugins/{namespace}/{pluginName} Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves a specific plugin by namespace and name. Returns a registry.Plugin object. ```APIDOC ## GET /registry/{registryName}/v0.1/x/dev.toolhive/plugins/{namespace}/{pluginName} ### Description Retrieves a specific plugin by namespace and name. ### Method GET ### Endpoint /registry/{registryName}/v0.1/x/dev.toolhive/plugins/{namespace}/{pluginName} ### Parameters #### Path Parameters - **registryName** (string) - Required - The name of the registry. - **namespace** (string) - Required - The plugin namespace. - **pluginName** (string) - Required - The plugin name. ### Response #### Success Response (200) - **registry.Plugin** - The plugin data. #### Error Responses - **404** - Plugin not found. - **500** - Internal server error. - **503** - Service unavailable. ``` -------------------------------- ### GET /registry/{registryName}/v0.1/x/dev.toolhive/plugins Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Lists plugins in a registry using the public registry protocol v0.1. Supports search and pagination. ```APIDOC ## GET /registry/{registryName}/v0.1/x/dev.toolhive/plugins ### Description Lists plugins in a registry using the public registry protocol v0.1. ### Method GET ### Endpoint /registry/{registryName}/v0.1/x/dev.toolhive/plugins ### Parameters #### Path Parameters - **registryName** (string) - Required - The name of the registry. #### Query Parameters - **q** (string) - Optional - Search query. - **page** (int) - Optional - Page number. - **limit** (int) - Optional - Number of results per page. ### Response #### Success Response (200) - **pluginsV01Response** - The list of plugins. #### Error Responses - **500** - Internal server error. - **503** - Service unavailable. ``` -------------------------------- ### Check and configure LLM Gateway Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-api.md Shows a typical usage pattern: first check gateway status, and if not configured, save the gateway configuration with URL, issuer, and client ID. The saveConfig call triggers cache invalidation, enables Playground, and starts the proxy on success. ```ts const status = await window.electronAPI.chat.llmGateway.getStatus() if (!status.configured) { await window.electronAPI.chat.llmGateway.saveConfig({ gatewayUrl, issuer, clientId }) } ``` -------------------------------- ### threadSettings.getEnabledSkills Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-api.md Gets the enabled skills for a thread. ```APIDOC ## threadSettings.getEnabledSkills ### Description Gets the enabled skills for a thread. ### Method getEnabledSkills ### Parameters #### Path Parameters - **threadId** (string) - Required - The thread ID. ### Response #### Success Response - **Promise** - An array of enabled skill names. ``` -------------------------------- ### threadSettings.getSelectedModel Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-api.md Gets the selected model for a thread. ```APIDOC ## threadSettings.getSelectedModel ### Description Gets the selected model for a thread. ### Method getSelectedModel ### Parameters #### Path Parameters - **threadId** (string) - Required - The thread ID. ### Response #### Success Response - **Promise<{ provider: string; model: string } | null>** - The selected model or null if not set. ``` -------------------------------- ### featureFlagsApi Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/electron-api.md Provides methods to get, enable, disable, and list feature flags. The get method returns a boolean indicating whether the flag is enabled, enable and disable return void, and getAll returns a record of flags with their options and enabled state. ```APIDOC ## featureFlagsApi ### Description Provides methods to get, enable, disable, and list feature flags. The get method returns a boolean indicating whether the flag is enabled, enable and disable return void, and getAll returns a record of flags with their options and enabled state. ### Methods - **get** (key: string) => Promise - Returns whether the feature flag is enabled. - **enable** (key: string) => Promise - Enables the feature flag. - **disable** (key: string) => Promise - Disables the feature flag. - **getAll** () => Promise> - Returns all feature flags with their options and enabled state. ``` -------------------------------- ### createClient function signature Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/configuration.md Signature for the generated hey-api client factory. `ClientOptions` includes `baseUrl`, `headers`, `fetch`, `querySerializer`, `bodySerializer`, `credentials`, `auth`, `cache`, `throwOnError`, `AbortSignal`, etc. The main process uses `createMainProcessApiClient()` with `baseUrl: 'http://localhost'` and a custom fetch that dials the thv socket; renderer usage goes through the `api-fetch` IPC bridge. ```TypeScript createClient(options?: ClientOptions): Client ``` -------------------------------- ### GET /api/v1beta/groups Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves a list of groups. ```APIDOC ## GET /api/v1beta/groups ### Description Retrieves a list of groups. ### Method GET ### Endpoint /api/v1beta/groups ### Response #### Success Response (200) - **body** (groupListResponse) - List of groups. #### Response Example ```json {} ``` ### Error Handling - **500** - Internal server error. ``` -------------------------------- ### appApi.showApp Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/electron-api.md Shows the app (shows Dock on macOS, focuses/creates window). ```APIDOC ## [POST] appApi.showApp ### Description Shows the app (shows Dock on macOS, focuses/creates window). ### Method POST ### Endpoint appApi.showApp ### Parameters None ### Response #### Success Response (200) - **void** - No return value. #### Response Example ```json null ``` ``` -------------------------------- ### Using Scenarios in Tests Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/mocks.md Shows how to activate defined scenarios in tests using activateScenario with MockScenarios.Empty and MockScenarios.ServerError. Includes placeholder comments for test logic. ```typescript import { MockScenarios } from '@mocks' import { mockedGetApiV1BetaGroups } from '@mocks/fixtures/groups/get' describe('groups', () => { it('handles empty groups', async () => { mockedGetApiV1BetaGroups.activateScenario(MockScenarios.Empty) // Test empty state... }) it('handles server error', async () => { mockedGetApiV1BetaGroups.activateScenario(MockScenarios.ServerError) // Test error handling... }) }) ``` -------------------------------- ### agents.getThreadAgentId Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-api.md Gets the agent ID associated with a specific thread. ```APIDOC ## agents.getThreadAgentId ### Description Gets the agent ID associated with a specific thread. ### Method getThreadAgentId ### Parameters #### Path Parameters - **threadId** (string) - Required - The thread ID. ### Response #### Success Response - **Promise** - The agent ID or null if not set. ``` -------------------------------- ### Generate app icons with pnpm run generate-icons Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/icons.md Run this command after replacing images in the source folders to regenerate application icons. ```shell pnpm run generate-icons ``` -------------------------------- ### OsDesign helper usage in renderer DevTools console Source: https://github.com/stacklok/toolhive-studio/blob/main/docs/README.md Use these commands in the renderer DevTools console to simulate different OS window chrome. Each set* call writes to sessionStorage and reloads the page; the override is scoped to the current session and only affects visual layout, not behavioral logic. ```javascript OsDesign.setMac() // macOS layout (traffic-light padding, no custom controls) OsDesign.setWindows() // Windows/Linux layout (custom min/max/close buttons) OsDesign.reset() // restore the real platform detection OsDesign.current() // log the currently active variant ``` -------------------------------- ### GET /api/v1beta/groups/{name} Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves a group by name. ```APIDOC ## GET /api/v1beta/groups/{name} ### Description Retrieves a group by name. ### Method GET ### Endpoint /api/v1beta/groups/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the group. ### Response #### Success Response (200) - **body** (github_com_stacklok_toolhive_pkg_groups.Group) - The group object. #### Response Example ```json {} ``` ### Error Handling - **404** - Group not found. - **500** - Internal server error. ``` -------------------------------- ### GET /api/v1beta/discovery/clients Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves per-client status information. ```APIDOC ## GET /api/v1beta/discovery/clients ### Description Retrieves per-client status information. ### Method GET ### Endpoint /api/v1beta/discovery/clients ### Response #### Success Response (200) - **body** (clientStatusResponse) - Per-client status. #### Response Example ```json {} ``` ``` -------------------------------- ### Renderer usage: start stream and listen for done/error events Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/streaming-service.md Starts a chat stream via `window.electronAPI.chat.stream(request)` and subscribes to `chat:stream:done` and `chat:stream:error` events. The done handler updates messages only for the matching `chatId` and unsubscribes after the first match; the error handler shows the error for the matching chat. ```TypeScript const { streamId } = await window.electronAPI.chat.stream(request) const offDone = window.electronAPI.on('chat:stream:done', (_e, payload) => { if (payload.chatId !== request.chatId) return setMessages(payload.messages) offDone() }) const offError = window.electronAPI.on('chat:stream:error', (_e, err) => { if (err.chatId === request.chatId) showError(err.error) }) ``` -------------------------------- ### Override BRANDING_CONFIG_PATH for test-theme.json Source: https://github.com/stacklok/toolhive-studio/blob/main/branding-examples/README.md Launch the app with the test-theme.json branding by setting the BRANDING_CONFIG_PATH environment variable. This is used to stress-test that every themeable surface is wired to the override. ```bash BRANDING_CONFIG_PATH="$PWD/branding-examples/test-theme.json" pnpm run start ``` -------------------------------- ### appApi.getAutoLaunchStatus Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/electron-api.md Returns the current auto-launch status as a boolean. ```APIDOC ## [GET] appApi.getAutoLaunchStatus ### Description Returns the current auto-launch status as a boolean. ### Method GET ### Endpoint appApi.getAutoLaunchStatus ### Parameters None ### Response #### Success Response (200) - **boolean** - The current auto-launch status. #### Response Example ```json true ``` ``` -------------------------------- ### GET /api/v1beta/workloads/{name}/status Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves the status of a workload. ```APIDOC ## GET /api/v1beta/workloads/{name}/status ### Description Retrieves the status of a workload. ### Method GET ### Endpoint /api/v1beta/workloads/{name}/status ### Parameters #### Path Parameters - **name** (string) - Required - The name of the workload. ### Response #### Success Response (200) - **body** (workloadStatusResponse) - The workload status. #### Response Example ```json {} ``` ### Error Handling - **404** - Workload not found. ``` -------------------------------- ### dialogsApi — dialogs.ts Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/electron-api.md Provides file and folder selection dialogs. selectFile uses properties ['openFile'] and selectFolder uses ['openDirectory']; both return null when cancelled or on errors. isDirectory returns false for non-strings, empty strings, and stat errors. ```TypeScript selectFile: () => Promise // dialog:select-file selectFolder:() => Promise // dialog:select-folder isDirectory: (path: string) => Promise // dialog:is-directory ``` -------------------------------- ### GET /api/v1beta/workloads/{name}/logs Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves logs for a workload. ```APIDOC ## GET /api/v1beta/workloads/{name}/logs ### Description Retrieves logs for a workload. ### Method GET ### Endpoint /api/v1beta/workloads/{name}/logs ### Parameters #### Path Parameters - **name** (string) - Required - The name of the workload. ### Response #### Success Response (200) - **body** (text/plain) - Logs in plain text. #### Response Example ```text log line 1 log line 2 ``` ### Error Handling - **400** - Invalid name. - **404** - Workload not found. ``` -------------------------------- ### featureFlagsApi interface — preload/src/api/feature-flags.ts Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/feature-flags.md Defines the IPC-exposed featureFlags API available on window.electronAPI. Methods map to IPC channels feature-flags:get, feature-flags:enable, feature-flags:disable, and feature-flags:get-all. get returns a Promise, getAll returns a record of options merged with the live enabled state. ```ts featureFlags: { get: (key: string) => Promise // feature-flags:get enable: (key: string) => Promise // feature-flags:enable disable: (key: string) => Promise // feature-flags:disable getAll: () => Promise> // feature-flags:get-all } ``` -------------------------------- ### fetchUiResource Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/chat-api.md Fetches an HTML resource for an MCP App, including CSP and permission grants for sandboxing. ```APIDOC ## fetchUiResource ### Description Fetches an HTML resource for an MCP App, including CSP and permission grants for sandboxing. ### Method Function call ### Signature `fetchUiResource: (serverName: string, resourceUri: string) => Promise<{ success: boolean; html?: string; csp?: { connectDomains?: string[]; resourceDomains?: string[]; frameDomains?: string[]; baseUriDomains?: string[] }; permissions?: { camera?: object; microphone?: object; geolocation?: object; clipboardWrite?: object }; prefersBorder?: boolean; error?: string }>` ### Parameters - **serverName** (string) - Required - The name of the MCP server. - **resourceUri** (string) - Required - The URI of the resource to fetch. ### Returns - **Promise<{ success: boolean; html?: string; csp?: { connectDomains?: string[]; resourceDomains?: string[]; frameDomains?: string[]; baseUriDomains?: string[] }; permissions?: { camera?: object; microphone?: object; geolocation?: object; clipboardWrite?: object }; prefersBorder?: boolean; error?: string }>** - An object containing the HTML content, CSP, permissions, and optional error. ``` -------------------------------- ### appApi.setAutoLaunch Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/electron-api.md Sets the auto-launch status and refreshes the tray status and application menu, returning the new status. ```APIDOC ## [POST] appApi.setAutoLaunch ### Description Sets the auto-launch status and refreshes the tray status and application menu, returning the new status. ### Method POST ### Endpoint appApi.setAutoLaunch ### Parameters #### Request Body - **enabled** (boolean) - Required - The new auto-launch status. ### Request Example ```json { "enabled": true } ``` ### Response #### Success Response (200) - **boolean** - The new auto-launch status. #### Response Example ```json true ``` ``` -------------------------------- ### GET /api/v1beta/workloads/{name}/proxy-logs Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves proxy logs for a workload. ```APIDOC ## GET /api/v1beta/workloads/{name}/proxy-logs ### Description Retrieves proxy logs for a workload. ### Method GET ### Endpoint /api/v1beta/workloads/{name}/proxy-logs ### Parameters #### Path Parameters - **name** (string) - Required - The name of the workload. ### Response #### Success Response (200) - **body** (text/plain) - Proxy logs in plain text. #### Response Example ```text proxy log line 1 proxy log line 2 ``` ### Error Handling - **400** - Invalid request. - **404** - Workload not found. ``` -------------------------------- ### Override BRANDING_CONFIG_PATH for cloud-ui.json Source: https://github.com/stacklok/toolhive-studio/blob/main/branding-examples/README.md Launch the app with the cloud-ui.json branding by setting the BRANDING_CONFIG_PATH environment variable. This palette is a port of toolhive-cloud-ui's default palette. ```bash BRANDING_CONFIG_PATH="$PWD/branding-examples/cloud-ui.json" pnpm run start ``` -------------------------------- ### GET /api/v1beta/workloads/{name} Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves the full configuration of a workload by name. ```APIDOC ## GET /api/v1beta/workloads/{name} ### Description Retrieves the full configuration of a workload by name. ### Method GET ### Endpoint /api/v1beta/workloads/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the workload. ### Response #### Success Response (200) - **body** (pkg_api_v1.createRequest) - Full workload configuration. #### Response Example ```json {} ``` ### Error Handling - **404** - Workload not found. ``` -------------------------------- ### reinstall Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/cli-alignment.md Reinstalls the CLI symlink. Returns a success flag and an optional error message if the operation fails. ```APIDOC ## reinstall ### Description Reinstalls the CLI symlink. Returns a success flag and an optional error message if the operation fails. ### Method Promise ### Endpoint window.electronAPI.cliAlignment.reinstall() ### Parameters None ### Response #### Success Response - **success** (boolean) - Indicates whether the reinstall succeeded - **error** (string, optional) - Error message if the reinstall failed #### Response Example ```json { "success": true, "error": null } ``` ``` -------------------------------- ### GET /api/v1beta/workloads Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Retrieves a list of workloads, optionally filtered by group. ```APIDOC ## GET /api/v1beta/workloads ### Description Retrieves a list of workloads, optionally filtered by group. ### Method GET ### Endpoint /api/v1beta/workloads ### Parameters #### Query Parameters - **all** (boolean) - Optional - If true, returns all workloads. - **group** (string) - Optional - Filter by group name. ### Response #### Success Response (200) - **body** (workloadListResponse) - List of workloads. #### Response Example ```json {} ``` ### Error Handling - **404** - Group not found. ``` -------------------------------- ### POST /api/v1beta/workloads Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/endpoints.md Creates a new workload (MCP server). ```APIDOC ## POST /api/v1beta/workloads ### Description Creates a new workload (MCP server). ### Method POST ### Endpoint /api/v1beta/workloads ### Parameters #### Request Body - **body** (pkg_api_v1.createRequest) - Required - Workload creation details including image, transport, env, and permissions. ### Request Example ```json {} ``` ### Response #### Success Response (201) - **body** (createWorkloadResponse) - The created workload response. #### Response Example ```json {} ``` ### Error Handling - **400** - Invalid request. - **409** - Conflict. ``` -------------------------------- ### dialogsApi.selectFolder Source: https://github.com/stacklok/toolhive-studio/blob/main/_autodocs/api-reference/electron-api.md Opens a folder selection dialog and returns the selected folder path, or null if cancelled. ```APIDOC ## dialogsApi.selectFolder ### Description Opens a folder selection dialog and returns the selected folder path, or null if cancelled. ### Method IPC Channel: `dialog:select-folder` ### Returns - **Promise** - Resolves to the selected folder path, or `null` if cancelled or an error occurs. ```