feat(mcp): expand resources with pinned_files/milestones and handoff_routine prompt

This commit is contained in:
Riz Ashraf committed 2026-09-27 21:52:35 +01:00
1 parent f970e1219d
commit d2b4f69f97
1 file changed
+54
+54
View File
@@ -133,6 +133,60 @@ impl MemoryHandler {
register_resource!(TasksActiveResource);
register_prompt!(AnalyzeTechDebtPrompt);
struct PinnedFilesResource;
#[async_trait]
impl McpResource for PinnedFilesResource {
fn uri(&self) -> &'static str { "memory://pinned_files" }
fn name(&self) -> &'static str { "Pinned Files" }
fn description(&self) -> Option<&'static str> { Some("Currently pinned files in the workspace") }
async fn read(&self, state: Arc<MemoryState>) -> Result<String, String> {
let state_clone = Arc::clone(&state);
tokio::task::spawn_blocking(move || {
let items = state_clone.pinned_files.cache.read().unwrap();
Ok(serde_json::to_string_pretty(&*items).unwrap_or_default())
}).await.unwrap()
}
}
struct MilestonesResource;
#[async_trait]
impl McpResource for MilestonesResource {
fn uri(&self) -> &'static str { "memory://milestones" }
fn name(&self) -> &'static str { "Milestones" }
fn description(&self) -> Option<&'static str> { Some("Project milestones and their status") }
async fn read(&self, state: Arc<MemoryState>) -> Result<String, String> {
let state_clone = Arc::clone(&state);
tokio::task::spawn_blocking(move || {
let items = state_clone.milestones.cache.read().unwrap();
Ok(serde_json::to_string_pretty(&*items).unwrap_or_default())
}).await.unwrap()
}
}
struct HandoffRoutinePrompt;
#[async_trait]
impl McpPrompt for HandoffRoutinePrompt {
fn name(&self) -> &'static str { "handoff_routine" }
fn description(&self) -> Option<&'static str> { Some("Initiate the end-of-session handoff and standup report generation") }
async fn get(&self, _args: Value, _state: Arc<MemoryState>) -> Result<serde_json::Value, String> {
Ok(serde_json::json!({
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "I am logging off. Please invoke the DevOpsSRE subagent to generate a standup report and leave a handoff memo for the next session. Make sure to check active tasks and recent code changes."
}
}
]
}))
}
}
register_resource!(PinnedFilesResource);
register_resource!(MilestonesResource);
register_prompt!(HandoffRoutinePrompt);
macro_rules! register {
($module:ident::$handler:ident) => {