fix(mcp): resolve link target to its internal id on removal #131

Merged
Claude-Run merged 1 commit from fix/YT-78-remove-issue-link-internal-id into main 2026-07-21 12:00:26 +02:00
Member

The DELETE path for a link removal (/api/issues/{id}/links/{slot}/issues/{target}) requires the target's INTERNAL issue id in the trailing segment; the readable id the caller supplied was interpolated verbatim, so every remove_issue_link call made with readable ids 404d with "Entity with id ROCI-55 not found" even though the link existed. The source issue and the link slot were already resolved, which is why only the trailing entity failed.

delete_link now resolves the target through /api/issues/{ref}?fields=id,idReadable, which accepts either id form, so readable and internal ids both work and remove_issue_link is a true inverse of link_issues. Resolving the target also makes it cheap to check the slot's member list first, so removing a link that does not exist is now an ApiError::Invalid surfaced as an MCP invalid-params error naming the missing link, distinct from an unresolvable issue id.

Tests cover both link directions, an internal target id, the missing-link error, and an end-to-end create-then-remove entirely by readable id asserting linkedIssueCounts drops.

#YT-78

The DELETE path for a link removal (`/api/issues/{id}/links/{slot}/issues/{target}`) requires the target's INTERNAL issue id in the trailing segment; the readable id the caller supplied was interpolated verbatim, so every `remove_issue_link` call made with readable ids 404d with "Entity with id ROCI-55 not found" even though the link existed. The source issue and the link slot were already resolved, which is why only the trailing entity failed. `delete_link` now resolves the target through `/api/issues/{ref}?fields=id,idReadable`, which accepts either id form, so readable and internal ids both work and `remove_issue_link` is a true inverse of `link_issues`. Resolving the target also makes it cheap to check the slot's member list first, so removing a link that does not exist is now an `ApiError::Invalid` surfaced as an MCP invalid-params error naming the missing link, distinct from an unresolvable issue id. Tests cover both link directions, an internal target id, the missing-link error, and an end-to-end create-then-remove entirely by readable id asserting `linkedIssueCounts` drops. #YT-78
fix(mcp): resolve link target to its internal id on removal
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 2m25s
Create release / Create release from merged PR (pull_request) Has been skipped
cb285d171a
The DELETE path for a link removal (`/api/issues/{id}/links/{slot}/issues/{target}`) requires the target's INTERNAL issue id in the trailing segment; the readable id the caller supplied was interpolated verbatim, so every `remove_issue_link` call made with readable ids 404d with "Entity with id ROCI-55 not found" even though the link existed. The source issue and the link slot were already resolved, which is why only the trailing entity failed.

`delete_link` now resolves the target through `/api/issues/{ref}?fields=id,idReadable`, which accepts either id form, so readable and internal ids both work and `remove_issue_link` is a true inverse of `link_issues`. Resolving the target also makes it cheap to check the slot's member list first, so removing a link that does not exist is now an `ApiError::Invalid` surfaced as an MCP invalid-params error naming the missing link, distinct from an unresolvable issue id.

Tests cover both link directions, an internal target id, the missing-link error, and an end-to-end create-then-remove entirely by readable id asserting `linkedIssueCounts` drops.

#YT-78
Claude-Run deleted branch fix/YT-78-remove-issue-link-internal-id 2026-07-21 12:00:27 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pandoras-box/youtrack-cli!131
No description provided.