Workspace Setup & Management
Use the query_workspaces and modify_workspaces tools to manage P4 client workspaces.
Querying Workspaces
| Action | Purpose | Key Parameters |
|---|---|---|
list |
List workspaces with filters | user, max_results |
get |
Get full workspace spec | workspace_name |
type |
Check if workspace is stream or classic | workspace_name |
status |
Get workspace sync status | workspace_name |
Modifying Workspaces
| Action | Purpose | Key Parameters |
|---|---|---|
create |
Create a new workspace | name, specs |
update |
Update workspace spec fields | name, specs |
delete |
Delete a workspace (requires approval) | name |
switch |
Switch active workspace | name |
Common Workflows
Create a stream workspace
query_streams→listto find available streamsmodify_workspaces→createwithspecscontaining the stream depot pathmodify_files→syncto populate the workspace
Create a classic workspace
modify_workspaces→createwithspecscontaining view mappings (depot-to-local paths)modify_files→syncto populate the workspace
Check workspace state
query_workspaces→getto see the current specquery_workspaces→typeto check if it's stream-bound or classicquery_workspaces→statusto see sync state (have vs head revisions)
Switch between workspaces
query_workspaces→listto see available workspacesmodify_workspaces→switchto set the active workspace
Best Practices
- Use stream workspaces when working with P4 streams — they auto-configure the view mapping from the stream spec.
- Set the workspace
rootto a directory that exists and is writable. - Use
query_workspaces→statusto check for out-of-date files before starting work. - Delete workspaces only when you're sure no pending changelists reference them.
- Each workspace must have a unique name on the P4 server.