feat(rulebook): augment get_project with applicable_rules + MCP instructions
This commit is contained in:
@@ -19,6 +19,7 @@ from __future__ import annotations
|
||||
from fabledassistant.mcp._context import current_user_id
|
||||
from fabledassistant.services import milestones as milestones_svc
|
||||
from fabledassistant.services import projects as projects_svc
|
||||
from fabledassistant.services import rulebooks as rulebooks_svc
|
||||
|
||||
|
||||
async def list_projects() -> dict:
|
||||
@@ -33,10 +34,11 @@ async def list_projects() -> dict:
|
||||
|
||||
|
||||
async def get_project(project_id: int) -> dict:
|
||||
"""Fetch a Scribe project by ID, including its milestone summary.
|
||||
"""Fetch a Scribe project by ID.
|
||||
|
||||
Returns full project fields plus a milestone_summary list with each
|
||||
milestone's id, title, status, and task counts.
|
||||
Returns full project fields, a milestone_summary list, and the
|
||||
rulebook-applicable_rules / subscribed_rulebooks pair the assistant
|
||||
should consult when working on this project.
|
||||
"""
|
||||
uid = current_user_id()
|
||||
project = await projects_svc.get_project(uid, project_id)
|
||||
@@ -46,6 +48,12 @@ async def get_project(project_id: int) -> dict:
|
||||
data["milestone_summary"] = await milestones_svc.get_project_milestone_summary(
|
||||
uid, project_id,
|
||||
)
|
||||
applicable = await rulebooks_svc.get_applicable_rules(
|
||||
project_id=project_id, user_id=uid,
|
||||
)
|
||||
data["applicable_rules"] = applicable["rules"]
|
||||
data["applicable_rules_truncated"] = applicable["truncated"]
|
||||
data["subscribed_rulebooks"] = applicable["subscribed_rulebooks"]
|
||||
return data
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user