Skip to content

refactor(mcp): complete trait-ization of remaining MCP tool layer#15

Merged
juice094 merged 1 commit into
mainfrom
refactor/mcp-trait-complete
May 11, 2026
Merged

refactor(mcp): complete trait-ization of remaining MCP tool layer#15
juice094 merged 1 commit into
mainfrom
refactor/mcp-trait-complete

Conversation

@juice094
Copy link
Copy Markdown
Owner

Summary

Phase B 收尾:消除 mcp/tools/ 目录下所有剩余生产代码内联调用,实现 MCP 工具层完全 trait 化。

Changes

  • RegistryClient 扩展
    • save_relation, query_relations, delete_relations, list_vault_notes
  • 新增 WorkflowClient trait
    • list_workflows, get_workflow, run_workflow, get_execution
  • 新增 VaultClient trait
    • list_vault_notes, read_vault_note, get_backlinks, build_vault_graph
  • AppContext Clone
    • env_cache 改为 Arc<Mutex<...>>,支持在 spawn_blocking 中安全 clone
  • 重构调用点
    • relations.rs / workflow.rs / vault.rs 全部改为 trait 调用

Verification

  • cargo check / cargo fmt / cargo clippy -W warnings
  • 427 tests all pass ✅

- Extend RegistryClient with save_relation, query_relations, delete_relations, list_vault_notes
- Add WorkflowClient trait (list_workflows, get_workflow, run_workflow, get_execution)
- Add VaultClient trait (list_vault_notes, read_vault_note, get_backlinks, build_vault_graph)
- Implement all traits on AppContext (registry.rs, workflow/mod.rs, vault/mod.rs)
- Enable AppContext Clone via Arc<Mutex<EnvVersionCache>> for spawn_blocking safety
- Refactor relations.rs, workflow.rs, vault.rs to use trait calls exclusively
- Eliminate all production-code inline crate:: calls in mcp/tools/ relations|workflow|vault
@juice094 juice094 merged commit 59174b4 into main May 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant