delete_workspace
Delete an AnythingLLM workspace by providing its slug to remove it from the platform permanently.
Instructions
Delete a workspace
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes |
Implementation Reference
- src/index.ts:73-73 (registration)The tool 'delete_workspace' is registered here as 'workspace_delete' under the description 'Delete workspace'. Note: the tool name is 'workspace_delete', not literally 'delete_workspace'.
{ name: "workspace_delete", description: "Delete workspace", inputSchema: { type: "object", properties: { slug: { type: "string" } }, required: ["slug"] } }, - src/index.ts:96-96 (handler)Handler for the 'workspace_delete' tool. It sends a DELETE request to '/workspace/{slug}' using the apiRequest helper.
else if (name === "workspace_delete") { result = await apiRequest("/workspace/" + args?.slug, "DELETE"); } - src/index.ts:73-73 (schema)Input schema for 'workspace_delete' (delete_workspace): expects a 'slug' string property which is required.
{ name: "workspace_delete", description: "Delete workspace", inputSchema: { type: "object", properties: { slug: { type: "string" } }, required: ["slug"] } }, - src/index.ts:23-55 (helper)The apiRequest function is the helper utility used to make HTTP requests to the AnythingLLM API. It handles the DELETE request for workspace deletion.
function apiRequest(path: string, method = "GET", body?: any, extraHeaders = {}): Promise<any> { return new Promise((resolve, reject) => { const baseUrl = new URL(ANYTHING_LLM_BASE); const fullUrl = new URL(path, baseUrl); const options: any = { hostname: fullUrl.hostname, port: fullUrl.port || (fullUrl.protocol === "https:" ? 443 : 80), path: fullUrl.pathname + fullUrl.search, method, headers: Object.assign({ "Authorization": "Bearer " + ANYTHING_LLM_API_KEY, "Content-Type": "application/json", "Accept": "application/json", }, extraHeaders), }; const lib = fullUrl.protocol === "https:" ? https : http; const req = lib.request(options, (res: any) => { let data = ""; res.on("data", (chunk: string) => { data += chunk; }); res.on("end", () => { try { resolve(data ? JSON.parse(data) : {}); } catch { resolve({ raw: data }); } }); }); req.on("error", reject); if (body) req.write(JSON.stringify(body)); req.end(); }); }