Skip to content

feat(mcp): add update-workspace-tool for brand settings - #1

Merged
Cryptoom merged 2 commits into
mainfrom
claude/trypost-update-workspace-tool
Aug 25, 2026
Merged

Cryptoom merged 2 commits into
mainfrom
claude/trypost-update-workspace-tool

Conversation

@Cryptoom

Copy link
Copy Markdown
Owner

Summary

  • Adds UpdateWorkspaceTool, a new MCP tool that writes the current workspace's brand settings (name, brand_website, brand_description, brand_voice_traits, brand_color, background_color, text_color, brand_font, image_style, content_language). GetWorkspaceTool was read only, there was no API/MCP path to write these fields.
  • PATCH semantics: every field is optional, only the fields actually passed are validated and written. Validation mirrors UpdateWorkspaceRequest.
  • Authorization mirrors the settings UI: AuthorizesMcpTool::authorizeCurrentWorkspace($request, 'update', ...), same WorkspacePolicy::update ability as WorkspaceController::updateSettings().
  • Registered in TryPostServer under the existing "Workspace" section.
  • Documented as fork Patch 1 in PATCHES.md (this repo is AGPL-3.0, patches are tracked so a future upstream merge does not silently clobber it).

Test plan

  • tests/Feature/Mcp/WorkspaceToolTest.php: 4 new tests (valid partial update, invalid brand_color rejected, cannot touch another workspace, member without Admin/Owner role denied).
  • php artisan test tests/Feature/Mcp, 190/190 passing.
  • Verified no unintended file changes (git status --short before commit only shows the 4 intended files).

No changes to UpdateWorkspaceRequest, WorkspacePolicy, or any other existing tool/validation logic.

GetWorkspaceTool is read-only; there was no API or MCP path to write a
workspace's brand settings (name, colors, voice traits, font, image
style, content language). Adds UpdateWorkspaceTool mirroring
UpdateWorkspaceRequest's validation with PATCH semantics (only passed
fields change), gated on the same 'update' ability as the settings UI.

Registered as fork Patch 1 in PATCHES.md.
UpdateWorkspaceTool validated brand_voice_traits against the enum but
never ran BrandVoiceTrait::coerce(), so an update could store an
incoherent set (e.g. both formal and casual). This is the first
programmatic/unattended MCP write path, so coerce it here before the
values land in the update payload.

Also rename a test whose name implied a cross-workspace injection
vector that the tool schema does not expose. The tool always resolves
the caller's current workspace; there is no workspace_id parameter to
attack.
@Cryptoom
Cryptoom merged commit a550d28 into main Aug 25, 2026
@Cryptoom
Cryptoom deleted the claude/trypost-update-workspace-tool branch August 25, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant