MCPcopy Create free account
hub / github.com/AutoForgeAI/autoforge / feature_create

Function feature_create

mcp_server/feature_mcp.py:630–680  ·  view source on GitHub ↗

Create a single feature in the project backlog. Use this when the user asks to add a new feature, capability, or test case. The feature will be added with the next available priority number. Args: category: Feature category for grouping (e.g., 'Authentication', 'API', 'UI')

(
    category: Annotated[str, Field(min_length=1, max_length=100, description="Feature category (e.g., 'Authentication', 'API', 'UI')")],
    name: Annotated[str, Field(min_length=1, max_length=255, description="Feature name")],
    description: Annotated[str, Field(min_length=1, description="Detailed description of the feature")],
    steps: Annotated[list[str], Field(min_length=1, description="List of implementation/verification steps")]
)

Source from the content-addressed store, hash-verified

628
629@mcp.tool()
630def feature_create(
631 category: Annotated[str, Field(min_length=1, max_length=100, description="Feature category (e.g., 'Authentication', 'API', 'UI')")],
632 name: Annotated[str, Field(min_length=1, max_length=255, description="Feature name")],
633 description: Annotated[str, Field(min_length=1, description="Detailed description of the feature")],
634 steps: Annotated[list[str], Field(min_length=1, description="List of implementation/verification steps")]
635) -> str:
636 """Create a single feature in the project backlog.
637
638 Use this when the user asks to add a new feature, capability, or test case.
639 The feature will be added with the next available priority number.
640
641 Args:
642 category: Feature category for grouping (e.g., 'Authentication', 'API', 'UI')
643 name: Descriptive name for the feature
644 description: Detailed description of what this feature should do
645 steps: List of steps to implement or verify the feature
646
647 Returns:
648 JSON with the created feature details including its ID
649 """
650 try:
651 # Use atomic transaction to prevent priority collisions
652 with atomic_transaction(_session_maker) as session:
653 # Get the next priority atomically within the transaction
654 result = session.execute(text("""
655 SELECT COALESCE(MAX(priority), 0) + 1 FROM features
656 """)).fetchone()
657 next_priority = result[0]
658
659 db_feature = Feature(
660 priority=next_priority,
661 category=category,
662 name=name,
663 description=description,
664 steps=steps,
665 passes=False,
666 in_progress=False,
667 )
668 session.add(db_feature)
669 session.flush() # Get the ID
670
671 feature_dict = db_feature.to_dict()
672 # Commit happens automatically on context manager exit
673
674 return json.dumps({
675 "success": True,
676 "message": f"Created feature: {name}",
677 "feature": feature_dict
678 })
679 except Exception as e:
680 return json.dumps({"error": str(e)})
681
682
683@mcp.tool()

Callers

nothing calls this directly

Calls 3

to_dictMethod · 0.95
atomic_transactionFunction · 0.90
FeatureClass · 0.90

Tested by

no test coverage detected