Skip to content

Add mutating repository, translation, and review tools - #1093

Open
ehoogerbeets wants to merge 1 commit into
mcp-05-textunit-readsfrom
mcp-06-writes
Open

ehoogerbeets wants to merge 1 commit into
mcp-05-textunit-readsfrom
mcp-06-writes

Conversation

@ehoogerbeets

Copy link
Copy Markdown
Contributor

Transferred from ehoogerbeets#14 onto box/mojito (rebased onto master).

Stack note: this PR targets mcp-05-textunit-reads — merge bottom-up.

What this adds

The first write tools on the MCP server — everything before this was read-only:

  • mojito_repo_create / mojito_repo_delete — stand up or soft-delete a Mojito project
  • mojito_textunit_translation_add — save a translation for one string in one locale
  • mojito_review_update — accept / needs-review / needs-translation / reject, matching the workbench review modal

All four are destructive on prod. Tool descriptions tell the agent to confirm environment and ids, and to prefer mojito-dev while experimenting.

What the underlying APIs do

POST /api/repositories creates a repository (unique name; HTTP 409 on conflict). A simple create (name, optional description, optional checkSLA) is sent as CLI fields. Nested creates — target locales and integrity checkers — cannot be expressed as flat -f flags, so the client writes a temp JSON file and POSTs it with --input, then deletes that file on both success and failure.

Locales use Mojito CLI -l encoding, e.g. de-DE, (fr-CA)->fr-FR (inheritance), (en-GB) (partial). The parser rejects malformed strings rather than guessing.

DELETE /api/repositories/{id} is a soft delete: the repo disappears from normal listings; it is not a hard wipe of TM data. Still treated as destructive because it hides a real project from the UI.

POST /api/textunits (translation add) creates a new current TMTextUnitVariant. It needs tmTextUnitId, numeric localeId (from search/info, not the BCP-47 tag), and target. Optional status and includedInLocalizedFile set review state; includedInLocalizedFile=false is how Mojito keeps a string out of shipped files. Empty target/comment and false flags are sent as typed fields so they are not dropped as falsy.

Review is the same POST, with workbench actions mapped for the agent so it does not have to remember status + inclusion pairs:

Action Status In localized file
accept APPROVED true
review REVIEW_NEEDED true
translate TRANSLATION_NEEDED true
reject TRANSLATION_NEEDED false

reject is the dangerous mapping: a wrong mapping would quietly drop a string from shipped files. The API also requires the current target text even when you are only changing review state.

Why an agent would use them

Create/delete is for standing up a sandbox repo or tearing one down after a test. Translation add is "here is the corrected French for this string." Review update is the workbench accept/reject flow after a human (or the agent, with confirmation) has looked at a translation. Prefer mojito_review_update over raw status fields for those four outcomes.

Stack

Depends on the text-unit reads PR. Next in this stack: live integration tests, then source-asset import.

Test plan

  • cd mojito-mcp && pnpm test
  • Review locale parser negatives and temp-file cleanup

Made with Cursor

Made with Cursor

Include locale-string parsing, temp-file JSON creates, and the workbench accept/reject/review/translate mappings.

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch has not been deployed

No deployments
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