Remove a dependency from a feature. Args: feature_id: The ID of the feature to remove a dependency from dependency_id: The ID of the dependency to remove Returns: JSON with success status and updated dependencies list, or error message
(
feature_id: Annotated[int, Field(ge=1, description="Feature to remove dependency from")],
dependency_id: Annotated[int, Field(ge=1, description="ID of dependency to remove")]
)
| 744 | |
| 745 | @mcp.tool() |
| 746 | def feature_remove_dependency( |
| 747 | feature_id: Annotated[int, Field(ge=1, description="Feature to remove dependency from")], |
| 748 | dependency_id: Annotated[int, Field(ge=1, description="ID of dependency to remove")] |
| 749 | ) -> str: |
| 750 | """Remove a dependency from a feature. |
| 751 | |
| 752 | Args: |
| 753 | feature_id: The ID of the feature to remove a dependency from |
| 754 | dependency_id: The ID of the dependency to remove |
| 755 | |
| 756 | Returns: |
| 757 | JSON with success status and updated dependencies list, or error message |
| 758 | """ |
| 759 | try: |
| 760 | # Use atomic transaction for consistent read-modify-write |
| 761 | with atomic_transaction(_session_maker) as session: |
| 762 | feature = session.query(Feature).filter(Feature.id == feature_id).first() |
| 763 | if not feature: |
| 764 | return json.dumps({"error": f"Feature {feature_id} not found"}) |
| 765 | |
| 766 | current_deps = feature.dependencies or [] |
| 767 | if dependency_id not in current_deps: |
| 768 | return json.dumps({"error": "Dependency does not exist"}) |
| 769 | |
| 770 | # Remove dependency atomically |
| 771 | new_deps = [d for d in current_deps if d != dependency_id] |
| 772 | feature.dependencies = new_deps if new_deps else None |
| 773 | # Commit happens automatically on context manager exit |
| 774 | |
| 775 | return json.dumps({ |
| 776 | "success": True, |
| 777 | "feature_id": feature_id, |
| 778 | "dependencies": new_deps |
| 779 | }) |
| 780 | except Exception as e: |
| 781 | return json.dumps({"error": f"Failed to remove dependency: {str(e)}"}) |
| 782 | |
| 783 | |
| 784 | @mcp.tool() |
nothing calls this directly
no test coverage detected