feat(server): inject explicit descriptions into MCP tools/list payload
This commit is contained in:
1 parent
44df610998
commit
02bafa5db1
2 files changed
+132
-54
No files matched your search
@@ -0,0 +1,78 @@
|
||||
import re
|
||||
|
||||
descriptions = {
|
||||
"create_entities": "Create new entities in the knowledge graph.",
|
||||
"create_relations": "Create new relations between entities in the knowledge graph.",
|
||||
"add_observations": "Add new observations to existing entities in the knowledge graph.",
|
||||
"delete_entities": "Delete entities from the knowledge graph.",
|
||||
"delete_observations": "Delete observations from existing entities.",
|
||||
"delete_relations": "Delete relations between entities.",
|
||||
"read_graph": "Read the entire knowledge graph.",
|
||||
"search_nodes": "Search for entities in the knowledge graph by name or type.",
|
||||
"open_nodes": "Open and retrieve full details of specific nodes in the knowledge graph.",
|
||||
"log_code_change": "Log a significant code change or refactor in the memory system.",
|
||||
"query_recent_changes": "Query recently logged code changes.",
|
||||
"visualize_graph": "Generate a visual representation of the knowledge graph.",
|
||||
"add_sticky_note": "Add a sticky note for unstructured thoughts or reminders.",
|
||||
"read_sticky_notes": "Read all active sticky notes.",
|
||||
"condense_entity": "Condense or summarize an entity's observations to reduce size.",
|
||||
"add_task": "Add a new task to the task tracker.",
|
||||
"update_task_status": "Update the status of an existing task.",
|
||||
"list_active_tasks": "List all currently active tasks.",
|
||||
"store_snippet": "Store a reusable code snippet.",
|
||||
"search_snippets": "Search through stored code snippets.",
|
||||
"delete_snippet": "Delete a stored code snippet.",
|
||||
"log_decision": "Log an architectural decision record (ADR).",
|
||||
"query_decisions": "Query architectural decision records.",
|
||||
"merge_entities": "Merge two entities in the knowledge graph into one.",
|
||||
"find_orphans": "Find orphaned entities (entities without any relations) in the graph.",
|
||||
"learn_preference": "Record a user preference or behavior to adapt future interactions.",
|
||||
"read_preferences": "Read all learned user preferences.",
|
||||
"log_error_fix": "Log a complex error and its fix for future reference.",
|
||||
"search_error_fixes": "Search through previously logged error fixes.",
|
||||
"pin_file": "Pin a file to keep it explicitly in the context workspace.",
|
||||
"unpin_file": "Unpin a file from the context workspace.",
|
||||
"list_pinned_files": "List all currently pinned files.",
|
||||
"add_session_summary": "Add a summary of the current session.",
|
||||
"get_project_timeline": "Get a timeline of major project events.",
|
||||
"leave_handoff_memo": "Leave a memo for the next session or agent.",
|
||||
"read_handoff_memos": "Read pending handoff memos.",
|
||||
"clear_handoff_memos": "Clear handoff memos after reading.",
|
||||
"update_env_fingerprint": "Update the environment fingerprint (e.g., OS, tool versions).",
|
||||
"read_env_fingerprint": "Read the current environment fingerprint.",
|
||||
"log_env_requirement": "Log a required tool or package for the environment.",
|
||||
"add_milestone": "Add a new project milestone.",
|
||||
"update_milestone": "Update the status of a project milestone.",
|
||||
"list_milestones": "List all project milestones.",
|
||||
"generate_standup_report": "Generate a standup report based on recent activity.",
|
||||
"register_environment": "Register details about a specific deployment environment.",
|
||||
"get_environment_details": "Get details about a registered environment.",
|
||||
"add_pr_checklist_item": "Add an item to the PR checklist.",
|
||||
"get_pr_checklist": "Get the current PR checklist.",
|
||||
"clear_pr_checklist": "Clear the PR checklist.",
|
||||
"log_tech_debt": "Log identified technical debt.",
|
||||
"resolve_tech_debt": "Mark a logged technical debt as resolved.",
|
||||
"list_tech_debt": "List all unresolved technical debt.",
|
||||
"save_context_workspace": "Save the current set of pinned files and context.",
|
||||
"load_context_workspace": "Load a previously saved context workspace.",
|
||||
"list_context_workspaces": "List all saved context workspaces.",
|
||||
"omni_search": "Search across all memory sources (graph, tasks, snippets, ADRs, etc.) at once.",
|
||||
"get_project_health": "Get a synthesized health report of the project based on memory data."
|
||||
}
|
||||
|
||||
def fix_handlers(filepath):
|
||||
with open(filepath, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
for tool_name, description in descriptions.items():
|
||||
# Match crate::mcp::tool_def::<...>("tool_name", "")
|
||||
# Note: sometimes it's on multiple lines for GenerateStandupReportTool etc.
|
||||
# But most are single line.
|
||||
pattern = r'(crate::mcp::tool_def::<[^>]+>\(\s*"' + tool_name + r'"\s*,\s*)""(\s*\))'
|
||||
replacement = r'\1"' + description + r'"\2'
|
||||
content = re.sub(pattern, replacement, content)
|
||||
|
||||
with open(filepath, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
fix_handlers("C:\\Users\\reazul.ashraf\\workspace\\rust\\mcp-memory\\server\\src\\handlers.rs")
|
||||
Reference in new issue
Block a user