Closedloop.ai
MCP Server

Branch Artifacts

Create or update the branch artifact that records a Git branch against a project repository

Overview

A branch artifact records a Git branch in Closedloop, so the branch can be linked to the document it implements. One tool writes it.

ToolScopePurpose
create_branch_artifactwriteCreate or update a branch artifact

The tool name uses underscores, unlike the other Closedloop tools. It is offered only when your grant carries write.

The tool returns its result as JSON text. A failure comes back as a tool result with isError: true whose text carries a title, a description, any remediation steps, and the error code, message, and timestamp when the API supplied them.

To read the links a branch has once it exists, use list-artifact-links on Artifact Links.


Create Branch Artifact

Tool: create_branch_artifact Scope: write Underlying API: POST /artifact-links/branches

The repository is not a parameter. The API uses the project's primary repository, so the project must have one configured. Calling the tool again for the same branch updates the existing branch artifact rather than creating a second one.

NameTypeRequiredDescription
projectIdstring (UUID)YesThe project, by UUID. Slugs are not accepted here.
branchNamestringYesThe exact Git branch name. At least 1 character; the API trims it and allows at most 256.
sourceArtifactIdstring (UUID) | nullNoAn artifact in your organization to link the branch to, by UUID.
defaultBranchstring | nullNoLegacy assertion of the repository's default branch. Closedloop's own repository data decides eligibility.
baseBranchstring | nullNoThe branch this branch is based on, when known.
baseBranchSourcestring | nullNoWhere baseBranch came from: pull_request_base, harness_input, mcp_input, migration_pr_base, or repository_default. The API uses repository_default when this is omitted. desktop_pull_request_base exists but is refused here, because only the Desktop sync may set it.
headShastring | nullNoThe branch's head commit SHA, when known.
headShaSourcestring | nullNoWhere headSha came from: push_webhook, pull_request_webhook, harness_input, mcp_input, explicit_sync, or migration_pr_head.

Returns

Only the branch artifact's id:

{ "id": "b7a1c3e2-5d4f-4a6b-9c8d-0e1f2a3b4c5d" }

Errors

StatusCause
—A non-UUID projectId or sourceArtifactId, an empty string field, or baseBranchSource: "desktop_pull_request_base" (baseBranchSource is not client-assertable) is rejected by the tool schema.
400Project has no primary repository configured.
400Branch artifact input is invalid.
400Source artifact is not eligible for the sourceArtifactId you passed.
404The project is not in your organization, or the branch artifact could not be found.

Example

create_branch_artifact(
  projectId: "550e8400-e29b-41d4-a716-446655440000",
  branchName: "feat/saved-carts",
  sourceArtifactId: "9b2c4d6e-8f0a-4b1c-9d2e-3f4a5b6c7d8e",
  baseBranch: "main",
  baseBranchSource: "mcp_input"
)

On this page