Skip to content

feat: add edit_asset MCP tool#58

Merged
bobby-smedley merged 8 commits into
mainfrom
feat/edit-asset
May 8, 2026
Merged

feat: add edit_asset MCP tool#58
bobby-smedley merged 8 commits into
mainfrom
feat/edit-asset

Conversation

@bobby-smedley
Copy link
Copy Markdown
Contributor

@bobby-smedley bobby-smedley commented Apr 27, 2026

🎯 What does this PR do?

Adds the edit_asset MCP tool — a single entry point for updating any Collibra asset via a typed operations array.

Eight operation types

  • update_attribute, add_attribute, remove_attribute
  • update_property (whitelisted: name, displayName, statusId)
  • add_relation, remove_relation
  • add_tag
  • set_responsibility

Server-side niceties (no agent plumbing required)

  • Name → ID resolution: attribute names, relation roles, resource roles, status names, and user identifiers (username or email) all resolve server-side via Collibra's REST API. The agent never has to pass a raw UUID for a human-known name.
  • Case-insensitive + whitespace-tolerant matching on every name lookup so "candidate", " Candidate ", and "CANDIDATE" all hit.
  • Errors suggest valid options — e.g. attribute "Bogus" is not valid for asset type "Business Term" in this domain. Attributes available: Acronym, Definition, Note (and 4 more). so the model can self-correct in one step.
  • Two-phase execution / partial success: every op is validated against the asset's scoped assignment before any writes; invalid ops surface as per-op errors while valid siblings still apply (status: partial_success).
  • Bulk batching: 2+ same-type ops (add_attribute, update_attribute, add_relation) are coalesced into Collibra's /bulk endpoints; single ops use the cheaper individual endpoints.
  • Lazy resource fetches: /roles and /statuses are only fetched when the request actually contains an op that needs them.

Design decisions worth flagging

  • set_responsibility uses POST /rest/2.0/responsibilities (incremental, per-row) instead of the ticket-referenced PUT /rest/2.0/assets/{id}/responsibilities (destructive replace-all). Avoids an upsert-merge step.
  • add_relation assumes the edited asset is the relation's source (head). Reversed directions surface as a Collibra 4xx per-op error, which the agent can read and retry.
  • Ambiguous attributeName (multiple instances of the same attribute type) returns a disambiguation error rather than performing a silent multi-write.

Files

  • pkg/tools/edit_asset/{tool.go,operations.go,bulk.go,tool_test.go} — new package
  • pkg/clients/edit_asset_client.go — REST helpers + DTOs
  • pkg/tools/register.go — register the tool

Tests

40+ unit tests covering happy paths per op type, validation paths, partial success, bulk batching, name resolution (status/role/user), case-insensitive matching, suggestion-in-errors, and lazy-load checks. Test stub now strictly enforces real
Collibra wire formats so future field-name regressions fail loudly in CI.

✅ Checklist

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation (if needed).
  • My commit messages follow the Conventional Commits standard.

@bobby-smedley bobby-smedley requested a review from a team as a code owner April 27, 2026 19:08
@bobby-smedley bobby-smedley merged commit b263970 into main May 8, 2026
1 check passed
@bobby-smedley bobby-smedley deleted the feat/edit-asset branch May 8, 2026 15:27
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.

2 participants