|
<< Click to Display Table of Contents >> Navigation: »No topics above this level« AIN. - AnythingLLM AI |
MiniRobotLanguage (MRL)
AIN.ListWorkspaces
List All Available Workspaces
Intention
ListWorkspaces Command: Retrieve Workspace Inventory
The ListWorkspaces command fetches a list of all workspaces available in the AnythingLLM system.
This allows you to see and manage the workspaces you’ve created, providing an overview for further operations like chatting or document management.
It’s part of the AIN - AnythingLLM AI suite.
This command queries the AnythingLLM API to retrieve a list of all workspaces, returning their details in a JSON format.
You can store the response in a variable or on the stack, and it also provides a count of workspaces for easy reference.
Listing workspaces is essential for:
•Inventory Management: Get an overview of all workspaces in your AnythingLLM instance.
•Automation: Use the list to automate tasks across multiple workspaces.
•Selection: Identify specific workspaces for further operations like chatting or deletion.
Call the command with optional parameters to store the workspace list and count.
It leverages the API endpoint set by AIN.SetChatEndpoint (default: http://localhost:3001/api/workspaces).
Example Usage
AIN.ListWorkspaces|$$API|$$RES
DBP.Workspace Count: $$RES
DBP.Workspace List: $$API
This example stores the workspace count in $$RES and the JSON list in $$API.
Illustration
┌───────────────┐
│ Workspaces │
├───────────────┤
│ ["ws1", "ws2"]│
└───────────────┘
A simple depiction of retrieving the workspace list.
Syntax
AIN.ListWorkspaces[|P1][|P2]
AIN.LIW[|P1][|P2]
Parameter Explanation
P1 - (Optional) Variable to store the API key used for the request; if omitted, uses the default key.
P2 - (Optional) Variable to store the workspace count; if omitted, the count is stored on the stack.
Example
AIN.ListWorkspaces|$$API|$$CNT
DBP.Number of Workspaces: $$CNT
DBP.Workspace Details: $$API
ENR.
Remarks
- Requires a valid API key set via AIN.SetKey.
- The response is in JSON format, typically an array of workspace objects with slugs.
Limitations
- Limited to 3 parameters; excess parameters trigger an error.
- Does not filter or sort the list; returns all workspaces as provided by the API.
See also: