# write_workspace_file

在工作区中创建或覆盖写入文件。 如果父目录不存在会自动递归创建。 路径必须在已绑定的工作区范围内。 ⚠️ 会覆盖已有文件内容，请谨慎使用。

Agent View of the PolicyLayer registry record for `write_workspace_file`. HTML page: https://policylayer.com/tools/deepractice-promptx/write-workspace-file

## Facts

- Tool: `write_workspace_file`
- Server: PromptX (`deepractice/promptx`) — https://policylayer.com/tools/deepractice-promptx.md
- Homepage: https://github.com/Deepractice/PromptX
- Risk category: Write (Medium risk)
- Registry record: grade F, identity unverified
- Server rate-limited: no
- Parameters: 0
- Recommended policy verdict: Rate-limited

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "write_workspace_file",
    "arguments": {}
  }
}
```

## Why write_workspace_file is rated Medium

This tool creates or modifies files reversibly within a bounded workspace. While it can overwrite existing files, the action is reversible (files can be re-written or restored from backups), and the scope is constrained to the workspace boundary. This makes it Write rather than Destructive.

From the tool's own definition: "Tool name 'write_workspace_file' and description states it creates or overwrites files in a workspace ('在工作区中创建或覆盖写入文件'). The warning explicitly cautions about overwriting existing file content ('会覆盖已有文件内容，请谨慎使用')."

## Use case

AI agents use write_workspace_file to create or update resources in PromptX, usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your PromptX environment.

## Recommended policy (PolicyLayer)

Verdict: **Rate-limited**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches PromptX:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "write_workspace_file": {
      "limits": [
        {
          "counter": "write_workspace_file_rate",
          "window": "minute",
          "max": 30,
          "scope": "grant"
        }
      ]
    }
  }
}
```

## Other tools on PromptX (13)

- `delete_workspace_item` — Destructive — https://policylayer.com/tools/deepractice-promptx/delete-workspace-item.md
- `toolx` — Execute — https://policylayer.com/tools/deepractice-promptx/toolx.md
- `learn` — Read — https://policylayer.com/tools/deepractice-promptx/learn.md
- `list_workspace_directory` — Read — https://policylayer.com/tools/deepractice-promptx/list-workspace-directory.md
- `list_workspaces` — Read — https://policylayer.com/tools/deepractice-promptx/list-workspaces.md
- `list_xlsx_sheets` — Read — https://policylayer.com/tools/deepractice-promptx/list-xlsx-sheets.md
- `read_docx` — Read — https://policylayer.com/tools/deepractice-promptx/read-docx.md
- `read_pdf` — Read — https://policylayer.com/tools/deepractice-promptx/read-pdf.md
- `read_pptx` — Read — https://policylayer.com/tools/deepractice-promptx/read-pptx.md
- `read_workspace_file` — Read — https://policylayer.com/tools/deepractice-promptx/read-workspace-file.md
- `read_xlsx` — Read — https://policylayer.com/tools/deepractice-promptx/read-xlsx.md
- `create_workspace_directory` — Write — https://policylayer.com/tools/deepractice-promptx/create-workspace-directory.md
- `project` — Write — https://policylayer.com/tools/deepractice-promptx/project.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=deepractice-promptx · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/deepractice-promptx
