|
@@ -25,7 +25,7 @@ def _parse_values(values: str) -> dict[str, Any]:
|
|
|
return parsed
|
|
return parsed
|
|
|
|
|
|
|
|
|
|
|
|
|
-def _build_enum_field(field_name: str, value: int) -> dict[str, int]:
|
|
|
|
|
|
|
+def _build_enum_field(field_name: str, value: int) -> dict[str, dict]:
|
|
|
return {field_name: {"id": value}}
|
|
return {field_name: {"id": value}}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -142,3 +142,23 @@ def add_issue_note(
|
|
|
)
|
|
)
|
|
|
except RestApiError as error:
|
|
except RestApiError as error:
|
|
|
return _format_error(error)
|
|
return _format_error(error)
|
|
|
|
|
+
|
|
|
|
|
+@mcp.tool()
|
|
|
|
|
+def add_issue_relationship(
|
|
|
|
|
+ id: int = Field(..., description="The ID of the issue") ,
|
|
|
|
|
+ related_id: int = Field(..., description="The ID of the issue related to this issue"),
|
|
|
|
|
+ relationship: str = Field(..., description="Type of the relationship")
|
|
|
|
|
+) -> str:
|
|
|
|
|
+ """Add a relation between two existing issues."""
|
|
|
|
|
+ client = ClientREST()
|
|
|
|
|
+ body:dict[str, Any] = {
|
|
|
|
|
+ "issue" : {"id" : related_id},
|
|
|
|
|
+ "type" : {"name" : relationship}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try:
|
|
|
|
|
+ return _format_result(
|
|
|
|
|
+ client.execute(HTTPMethod.POST, f"/api/rest/issues/{id}/relationships", params=body)
|
|
|
|
|
+ )
|
|
|
|
|
+ except RestApiError as error:
|
|
|
|
|
+ return _format_error(error)
|