@hasna/mementos 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp/index.js +393 -43
- package/package.json +1 -1
package/dist/mcp/index.js
CHANGED
|
@@ -6824,42 +6824,370 @@ server.tool("graph_stats", "Get entity and relation counts by type.", {}, async
|
|
|
6824
6824
|
return { content: [{ type: "text", text: formatError(e) }], isError: true };
|
|
6825
6825
|
}
|
|
6826
6826
|
});
|
|
6827
|
-
var
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6827
|
+
var FULL_SCHEMAS = {
|
|
6828
|
+
memory_save: {
|
|
6829
|
+
description: "Save/upsert a memory. Creates new or merges with existing key.",
|
|
6830
|
+
category: "memory",
|
|
6831
|
+
params: {
|
|
6832
|
+
key: { type: "string", description: "Unique key for the memory (kebab-case recommended)", required: true },
|
|
6833
|
+
value: { type: "string", description: "The memory content", required: true },
|
|
6834
|
+
scope: { type: "string", description: "Visibility: global=all agents, shared=project, private=single agent", enum: ["global", "shared", "private"] },
|
|
6835
|
+
category: { type: "string", description: "Memory type", enum: ["preference", "fact", "knowledge", "history"] },
|
|
6836
|
+
importance: { type: "number", description: "Priority 1-10 (10=critical)" },
|
|
6837
|
+
tags: { type: "array", description: "Searchable tags", items: { type: "string" } },
|
|
6838
|
+
summary: { type: "string", description: "Short summary for display" },
|
|
6839
|
+
agent_id: { type: "string", description: "Agent UUID to scope this memory to" },
|
|
6840
|
+
project_id: { type: "string", description: "Project UUID to scope this memory to" },
|
|
6841
|
+
session_id: { type: "string", description: "Session UUID" },
|
|
6842
|
+
ttl_ms: { type: "string|number", description: "Time-to-live e.g. '7d', '2h', or ms integer" },
|
|
6843
|
+
source: { type: "string", description: "Origin of the memory", enum: ["user", "agent", "system", "auto", "imported"] },
|
|
6844
|
+
metadata: { type: "object", description: "Arbitrary JSON metadata" }
|
|
6845
|
+
},
|
|
6846
|
+
example: '{"key":"preferred-language","value":"TypeScript","scope":"global","importance":8,"tags":["language","preference"]}'
|
|
6847
|
+
},
|
|
6848
|
+
memory_recall: {
|
|
6849
|
+
description: "Recall a memory by exact key. Falls back to fuzzy search if no exact match.",
|
|
6850
|
+
category: "memory",
|
|
6851
|
+
params: {
|
|
6852
|
+
key: { type: "string", description: "Key to look up", required: true },
|
|
6853
|
+
scope: { type: "string", description: "Scope filter", enum: ["global", "shared", "private"] },
|
|
6854
|
+
agent_id: { type: "string", description: "Agent UUID filter" },
|
|
6855
|
+
project_id: { type: "string", description: "Project UUID filter" },
|
|
6856
|
+
session_id: { type: "string", description: "Session UUID filter" }
|
|
6857
|
+
},
|
|
6858
|
+
example: '{"key":"preferred-language","scope":"global"}'
|
|
6859
|
+
},
|
|
6860
|
+
memory_list: {
|
|
6861
|
+
description: "List memories with optional filters. Returns compact lines by default.",
|
|
6862
|
+
category: "memory",
|
|
6863
|
+
params: {
|
|
6864
|
+
scope: { type: "string", description: "Scope filter", enum: ["global", "shared", "private"] },
|
|
6865
|
+
category: { type: "string", description: "Category filter", enum: ["preference", "fact", "knowledge", "history"] },
|
|
6866
|
+
tags: { type: "array", description: "Filter by tags (AND logic)", items: { type: "string" } },
|
|
6867
|
+
min_importance: { type: "number", description: "Minimum importance threshold" },
|
|
6868
|
+
pinned: { type: "boolean", description: "Filter to pinned memories only" },
|
|
6869
|
+
agent_id: { type: "string", description: "Agent UUID filter" },
|
|
6870
|
+
project_id: { type: "string", description: "Project UUID filter" },
|
|
6871
|
+
session_id: { type: "string", description: "Session UUID filter" },
|
|
6872
|
+
status: { type: "string", description: "Memory status filter", enum: ["active", "archived", "expired"] },
|
|
6873
|
+
limit: { type: "number", description: "Max results (default 50)" },
|
|
6874
|
+
offset: { type: "number", description: "Pagination offset" },
|
|
6875
|
+
full: { type: "boolean", description: "Return full JSON objects instead of compact lines" },
|
|
6876
|
+
fields: { type: "array", description: "Fields to include in full mode", items: { type: "string" } }
|
|
6877
|
+
},
|
|
6878
|
+
example: '{"scope":"global","min_importance":7,"limit":20}'
|
|
6879
|
+
},
|
|
6880
|
+
memory_update: {
|
|
6881
|
+
description: "Update a memory's fields. Requires current version for optimistic concurrency.",
|
|
6882
|
+
category: "memory",
|
|
6883
|
+
params: {
|
|
6884
|
+
id: { type: "string", description: "Memory ID (partial OK)", required: true },
|
|
6885
|
+
version: { type: "number", description: "Current version (for conflict detection)", required: true },
|
|
6886
|
+
value: { type: "string", description: "New value" },
|
|
6887
|
+
category: { type: "string", description: "New category", enum: ["preference", "fact", "knowledge", "history"] },
|
|
6888
|
+
scope: { type: "string", description: "New scope", enum: ["global", "shared", "private"] },
|
|
6889
|
+
importance: { type: "number", description: "New importance 1-10" },
|
|
6890
|
+
tags: { type: "array", description: "New tags (replaces all)", items: { type: "string" } },
|
|
6891
|
+
summary: { type: "string", description: "New summary (null to clear)" },
|
|
6892
|
+
pinned: { type: "boolean", description: "Pin/unpin the memory" },
|
|
6893
|
+
status: { type: "string", description: "New status", enum: ["active", "archived", "expired"] },
|
|
6894
|
+
metadata: { type: "object", description: "New metadata (replaces existing)" },
|
|
6895
|
+
expires_at: { type: "string", description: "New expiry ISO timestamp (null to clear)" }
|
|
6896
|
+
},
|
|
6897
|
+
example: '{"id":"abc123","version":1,"importance":9,"tags":["correction","important"]}'
|
|
6898
|
+
},
|
|
6899
|
+
memory_forget: {
|
|
6900
|
+
description: "Delete a memory by ID or key.",
|
|
6901
|
+
category: "memory",
|
|
6902
|
+
params: {
|
|
6903
|
+
id: { type: "string", description: "Memory ID (partial OK)" },
|
|
6904
|
+
key: { type: "string", description: "Memory key" },
|
|
6905
|
+
scope: { type: "string", description: "Scope for key lookup", enum: ["global", "shared", "private"] },
|
|
6906
|
+
agent_id: { type: "string", description: "Agent UUID for key lookup" },
|
|
6907
|
+
project_id: { type: "string", description: "Project UUID for key lookup" }
|
|
6908
|
+
},
|
|
6909
|
+
example: '{"key":"old-preference","scope":"global"}'
|
|
6910
|
+
},
|
|
6911
|
+
memory_search: {
|
|
6912
|
+
description: "Full-text search across key, value, summary, and tags.",
|
|
6913
|
+
category: "memory",
|
|
6914
|
+
params: {
|
|
6915
|
+
query: { type: "string", description: "Search query", required: true },
|
|
6916
|
+
scope: { type: "string", description: "Scope filter", enum: ["global", "shared", "private"] },
|
|
6917
|
+
category: { type: "string", description: "Category filter", enum: ["preference", "fact", "knowledge", "history"] },
|
|
6918
|
+
tags: { type: "array", description: "Tag filter", items: { type: "string" } },
|
|
6919
|
+
agent_id: { type: "string", description: "Agent UUID filter" },
|
|
6920
|
+
project_id: { type: "string", description: "Project UUID filter" },
|
|
6921
|
+
limit: { type: "number", description: "Max results (default 20)" }
|
|
6922
|
+
},
|
|
6923
|
+
example: '{"query":"typescript","scope":"global","limit":10}'
|
|
6924
|
+
},
|
|
6925
|
+
memory_stats: {
|
|
6926
|
+
description: "Aggregate statistics: total, by scope, by category, pinned, expired counts.",
|
|
6927
|
+
category: "memory",
|
|
6928
|
+
params: {},
|
|
6929
|
+
example: "{}"
|
|
6930
|
+
},
|
|
6931
|
+
memory_export: {
|
|
6932
|
+
description: "Export memories as a JSON array.",
|
|
6933
|
+
category: "memory",
|
|
6934
|
+
params: {
|
|
6935
|
+
scope: { type: "string", description: "Scope filter", enum: ["global", "shared", "private"] },
|
|
6936
|
+
category: { type: "string", description: "Category filter", enum: ["preference", "fact", "knowledge", "history"] },
|
|
6937
|
+
agent_id: { type: "string", description: "Agent UUID filter" },
|
|
6938
|
+
project_id: { type: "string", description: "Project UUID filter" }
|
|
6939
|
+
},
|
|
6940
|
+
example: '{"scope":"global"}'
|
|
6941
|
+
},
|
|
6942
|
+
memory_import: {
|
|
6943
|
+
description: "Import memories from a JSON array. Merges by key by default.",
|
|
6944
|
+
category: "memory",
|
|
6945
|
+
params: {
|
|
6946
|
+
memories: { type: "array", description: "Array of memory objects with key+value (required), plus optional fields", required: true, items: { type: "object" } },
|
|
6947
|
+
overwrite: { type: "boolean", description: "false=create-only (skip existing keys), default=merge" }
|
|
6948
|
+
},
|
|
6949
|
+
example: '{"memories":[{"key":"foo","value":"bar","scope":"global","importance":7}]}'
|
|
6950
|
+
},
|
|
6951
|
+
memory_inject: {
|
|
6952
|
+
description: "Get formatted memory context for system prompt injection. Respects token budget.",
|
|
6953
|
+
category: "memory",
|
|
6954
|
+
params: {
|
|
6955
|
+
agent_id: { type: "string", description: "Agent UUID to include private memories" },
|
|
6956
|
+
project_id: { type: "string", description: "Project UUID to include shared memories" },
|
|
6957
|
+
session_id: { type: "string", description: "Session UUID" },
|
|
6958
|
+
max_tokens: { type: "number", description: "Approximate token budget (default 500)" },
|
|
6959
|
+
categories: { type: "array", description: "Categories to include (default: preference, fact, knowledge)", items: { type: "string", enum: ["preference", "fact", "knowledge", "history"] } },
|
|
6960
|
+
min_importance: { type: "number", description: "Minimum importance (default 3)" },
|
|
6961
|
+
raw: { type: "boolean", description: "true=plain lines only, false=wrapped in <agent-memories> tags" }
|
|
6962
|
+
},
|
|
6963
|
+
example: '{"project_id":"proj-uuid","max_tokens":300,"min_importance":5}'
|
|
6964
|
+
},
|
|
6965
|
+
memory_context: {
|
|
6966
|
+
description: "Get active memories for the current context (agent/project/scope).",
|
|
6967
|
+
category: "memory",
|
|
6968
|
+
params: {
|
|
6969
|
+
agent_id: { type: "string", description: "Agent UUID filter" },
|
|
6970
|
+
project_id: { type: "string", description: "Project UUID filter" },
|
|
6971
|
+
scope: { type: "string", description: "Scope filter", enum: ["global", "shared", "private"] },
|
|
6972
|
+
limit: { type: "number", description: "Max results (default 30)" }
|
|
6973
|
+
},
|
|
6974
|
+
example: '{"project_id":"proj-uuid","scope":"shared","limit":20}'
|
|
6975
|
+
},
|
|
6976
|
+
register_agent: {
|
|
6977
|
+
description: "Register an agent. Idempotent \u2014 same name returns existing agent.",
|
|
6978
|
+
category: "agent",
|
|
6979
|
+
params: {
|
|
6980
|
+
name: { type: "string", description: "Agent name (e.g. 'maximus', 'cassius')", required: true },
|
|
6981
|
+
description: { type: "string", description: "Agent description" },
|
|
6982
|
+
role: { type: "string", description: "Agent role (default: 'agent')" }
|
|
6983
|
+
},
|
|
6984
|
+
example: '{"name":"maximus","role":"developer"}'
|
|
6985
|
+
},
|
|
6986
|
+
list_agents: {
|
|
6987
|
+
description: "List all registered agents with IDs, names, roles, and last-seen timestamps.",
|
|
6988
|
+
category: "agent",
|
|
6989
|
+
params: {},
|
|
6990
|
+
example: "{}"
|
|
6991
|
+
},
|
|
6992
|
+
get_agent: {
|
|
6993
|
+
description: "Get agent details by UUID or name.",
|
|
6994
|
+
category: "agent",
|
|
6995
|
+
params: {
|
|
6996
|
+
id: { type: "string", description: "Agent UUID or name", required: true }
|
|
6997
|
+
},
|
|
6998
|
+
example: '{"id":"maximus"}'
|
|
6999
|
+
},
|
|
7000
|
+
update_agent: {
|
|
7001
|
+
description: "Update agent name, description, role, or metadata.",
|
|
7002
|
+
category: "agent",
|
|
7003
|
+
params: {
|
|
7004
|
+
id: { type: "string", description: "Agent UUID", required: true },
|
|
7005
|
+
name: { type: "string", description: "New name" },
|
|
7006
|
+
description: { type: "string", description: "New description" },
|
|
7007
|
+
role: { type: "string", description: "New role" },
|
|
7008
|
+
metadata: { type: "object", description: "New metadata" }
|
|
7009
|
+
},
|
|
7010
|
+
example: '{"id":"agent-uuid","role":"senior-developer"}'
|
|
7011
|
+
},
|
|
7012
|
+
register_project: {
|
|
7013
|
+
description: "Register a project for memory scoping. Idempotent by name.",
|
|
7014
|
+
category: "project",
|
|
7015
|
+
params: {
|
|
7016
|
+
name: { type: "string", description: "Project name (use git repo name)", required: true },
|
|
7017
|
+
path: { type: "string", description: "Absolute path to project root", required: true },
|
|
7018
|
+
description: { type: "string", description: "Project description" },
|
|
7019
|
+
memory_prefix: { type: "string", description: "Key prefix for project memories" }
|
|
7020
|
+
},
|
|
7021
|
+
example: '{"name":"open-mementos","path":"/Users/hasna/Workspace/hasna/opensource/opensourcedev/open-mementos"}'
|
|
7022
|
+
},
|
|
7023
|
+
list_projects: {
|
|
7024
|
+
description: "List all registered projects with IDs, names, and paths.",
|
|
7025
|
+
category: "project",
|
|
7026
|
+
params: {},
|
|
7027
|
+
example: "{}"
|
|
7028
|
+
},
|
|
7029
|
+
bulk_forget: {
|
|
7030
|
+
description: "Delete multiple memories by IDs in one call.",
|
|
7031
|
+
category: "bulk",
|
|
7032
|
+
params: {
|
|
7033
|
+
ids: { type: "array", description: "Array of memory IDs (partials OK)", required: true, items: { type: "string" } }
|
|
7034
|
+
},
|
|
7035
|
+
example: '{"ids":["abc123","def456"]}'
|
|
7036
|
+
},
|
|
7037
|
+
bulk_update: {
|
|
7038
|
+
description: "Apply the same field updates to multiple memories.",
|
|
7039
|
+
category: "bulk",
|
|
7040
|
+
params: {
|
|
7041
|
+
ids: { type: "array", description: "Array of memory IDs (partials OK)", required: true, items: { type: "string" } },
|
|
7042
|
+
importance: { type: "number", description: "New importance 1-10" },
|
|
7043
|
+
tags: { type: "array", description: "New tags (replaces all)", items: { type: "string" } },
|
|
7044
|
+
pinned: { type: "boolean", description: "Pin/unpin" },
|
|
7045
|
+
category: { type: "string", description: "New category", enum: ["preference", "fact", "knowledge", "history"] },
|
|
7046
|
+
status: { type: "string", description: "New status", enum: ["active", "archived", "expired"] }
|
|
7047
|
+
},
|
|
7048
|
+
example: '{"ids":["abc123","def456"],"importance":9,"tags":["important"]}'
|
|
7049
|
+
},
|
|
7050
|
+
clean_expired: {
|
|
7051
|
+
description: "Remove expired memories from the database. Returns count of removed entries.",
|
|
7052
|
+
category: "utility",
|
|
7053
|
+
params: {},
|
|
7054
|
+
example: "{}"
|
|
7055
|
+
},
|
|
7056
|
+
entity_create: {
|
|
7057
|
+
description: "Create a knowledge graph entity.",
|
|
7058
|
+
category: "graph",
|
|
7059
|
+
params: {
|
|
7060
|
+
name: { type: "string", description: "Entity name", required: true },
|
|
7061
|
+
type: { type: "string", description: "Entity type", required: true, enum: ["person", "project", "tool", "concept", "file", "api", "pattern", "organization"] },
|
|
7062
|
+
description: { type: "string", description: "Entity description" },
|
|
7063
|
+
project_id: { type: "string", description: "Project UUID to scope this entity" }
|
|
7064
|
+
},
|
|
7065
|
+
example: '{"name":"TypeScript","type":"tool","description":"Typed superset of JavaScript"}'
|
|
7066
|
+
},
|
|
7067
|
+
entity_get: {
|
|
7068
|
+
description: "Get entity details including relations summary and linked memory count.",
|
|
7069
|
+
category: "graph",
|
|
7070
|
+
params: {
|
|
7071
|
+
name_or_id: { type: "string", description: "Entity name or ID (partial OK)", required: true },
|
|
7072
|
+
type: { type: "string", description: "Type hint for name disambiguation", enum: ["person", "project", "tool", "concept", "file", "api", "pattern", "organization"] }
|
|
7073
|
+
},
|
|
7074
|
+
example: '{"name_or_id":"TypeScript"}'
|
|
7075
|
+
},
|
|
7076
|
+
entity_list: {
|
|
7077
|
+
description: "List entities with optional type, project, and search filters.",
|
|
7078
|
+
category: "graph",
|
|
7079
|
+
params: {
|
|
7080
|
+
type: { type: "string", description: "Type filter", enum: ["person", "project", "tool", "concept", "file", "api", "pattern", "organization"] },
|
|
7081
|
+
project_id: { type: "string", description: "Project UUID filter" },
|
|
7082
|
+
search: { type: "string", description: "Name search string" },
|
|
7083
|
+
limit: { type: "number", description: "Max results (default 50)" }
|
|
7084
|
+
},
|
|
7085
|
+
example: '{"type":"tool","limit":20}'
|
|
7086
|
+
},
|
|
7087
|
+
entity_delete: {
|
|
7088
|
+
description: "Delete an entity and all its relations.",
|
|
7089
|
+
category: "graph",
|
|
7090
|
+
params: {
|
|
7091
|
+
name_or_id: { type: "string", description: "Entity name or ID (partial OK)", required: true }
|
|
7092
|
+
},
|
|
7093
|
+
example: '{"name_or_id":"OldEntity"}'
|
|
7094
|
+
},
|
|
7095
|
+
entity_merge: {
|
|
7096
|
+
description: "Merge source entity into target \u2014 moves all relations and memory links.",
|
|
7097
|
+
category: "graph",
|
|
7098
|
+
params: {
|
|
7099
|
+
source: { type: "string", description: "Source entity name or ID (will be deleted)", required: true },
|
|
7100
|
+
target: { type: "string", description: "Target entity name or ID (will be kept)", required: true }
|
|
7101
|
+
},
|
|
7102
|
+
example: '{"source":"OldName","target":"NewName"}'
|
|
7103
|
+
},
|
|
7104
|
+
entity_link: {
|
|
7105
|
+
description: "Link an entity to a memory with a semantic role.",
|
|
7106
|
+
category: "graph",
|
|
7107
|
+
params: {
|
|
7108
|
+
entity_name_or_id: { type: "string", description: "Entity name or ID", required: true },
|
|
7109
|
+
memory_id: { type: "string", description: "Memory ID (partial OK)", required: true },
|
|
7110
|
+
role: { type: "string", description: "Semantic role (default: context)", enum: ["subject", "object", "context"] }
|
|
7111
|
+
},
|
|
7112
|
+
example: '{"entity_name_or_id":"TypeScript","memory_id":"abc123","role":"subject"}'
|
|
7113
|
+
},
|
|
7114
|
+
relation_create: {
|
|
7115
|
+
description: "Create a typed relation between two entities.",
|
|
7116
|
+
category: "graph",
|
|
7117
|
+
params: {
|
|
7118
|
+
source_entity: { type: "string", description: "Source entity name or ID", required: true },
|
|
7119
|
+
target_entity: { type: "string", description: "Target entity name or ID", required: true },
|
|
7120
|
+
relation_type: { type: "string", description: "Relation type", required: true, enum: ["uses", "knows", "depends_on", "created_by", "related_to", "contradicts", "part_of", "implements"] },
|
|
7121
|
+
weight: { type: "number", description: "Relation weight 0-1 (default 1.0)" }
|
|
7122
|
+
},
|
|
7123
|
+
example: '{"source_entity":"MyApp","target_entity":"TypeScript","relation_type":"uses"}'
|
|
7124
|
+
},
|
|
7125
|
+
relation_list: {
|
|
7126
|
+
description: "List relations for an entity, with optional type and direction filters.",
|
|
7127
|
+
category: "graph",
|
|
7128
|
+
params: {
|
|
7129
|
+
entity_name_or_id: { type: "string", description: "Entity name or ID", required: true },
|
|
7130
|
+
relation_type: { type: "string", description: "Type filter", enum: ["uses", "knows", "depends_on", "created_by", "related_to", "contradicts", "part_of", "implements"] },
|
|
7131
|
+
direction: { type: "string", description: "Direction filter (default: both)", enum: ["outgoing", "incoming", "both"] }
|
|
7132
|
+
},
|
|
7133
|
+
example: '{"entity_name_or_id":"MyApp","direction":"outgoing"}'
|
|
7134
|
+
},
|
|
7135
|
+
relation_delete: {
|
|
7136
|
+
description: "Delete a relation by ID.",
|
|
7137
|
+
category: "graph",
|
|
7138
|
+
params: {
|
|
7139
|
+
id: { type: "string", description: "Relation ID (partial OK)", required: true }
|
|
7140
|
+
},
|
|
7141
|
+
example: '{"id":"rel-abc123"}'
|
|
7142
|
+
},
|
|
7143
|
+
graph_query: {
|
|
7144
|
+
description: "Traverse the knowledge graph from an entity up to N hops. Returns entities and relations.",
|
|
7145
|
+
category: "graph",
|
|
7146
|
+
params: {
|
|
7147
|
+
entity_name_or_id: { type: "string", description: "Starting entity name or ID", required: true },
|
|
7148
|
+
depth: { type: "number", description: "Max traversal depth (default 2)" }
|
|
7149
|
+
},
|
|
7150
|
+
example: '{"entity_name_or_id":"MyApp","depth":3}'
|
|
7151
|
+
},
|
|
7152
|
+
graph_path: {
|
|
7153
|
+
description: "Find the shortest path between two entities in the knowledge graph.",
|
|
7154
|
+
category: "graph",
|
|
7155
|
+
params: {
|
|
7156
|
+
from_entity: { type: "string", description: "Starting entity name or ID", required: true },
|
|
7157
|
+
to_entity: { type: "string", description: "Target entity name or ID", required: true },
|
|
7158
|
+
max_depth: { type: "number", description: "Max search depth (default 5)" }
|
|
7159
|
+
},
|
|
7160
|
+
example: '{"from_entity":"Agent","to_entity":"Database","max_depth":4}'
|
|
7161
|
+
},
|
|
7162
|
+
graph_stats: {
|
|
7163
|
+
description: "Get entity and relation counts broken down by type.",
|
|
7164
|
+
category: "graph",
|
|
7165
|
+
params: {},
|
|
7166
|
+
example: "{}"
|
|
7167
|
+
},
|
|
7168
|
+
search_tools: {
|
|
7169
|
+
description: "Search available tools by name or keyword. Returns matching tool names and categories.",
|
|
7170
|
+
category: "meta",
|
|
7171
|
+
params: {
|
|
7172
|
+
query: { type: "string", description: "Search keyword (matches tool name or description)", required: true },
|
|
7173
|
+
category: { type: "string", description: "Category filter", enum: ["memory", "agent", "project", "bulk", "utility", "graph", "meta"] }
|
|
7174
|
+
},
|
|
7175
|
+
example: '{"query":"memory","category":"memory"}'
|
|
7176
|
+
},
|
|
7177
|
+
describe_tools: {
|
|
7178
|
+
description: "Get full parameter schemas and examples for specific tools. Omit names to list all tools.",
|
|
7179
|
+
category: "meta",
|
|
7180
|
+
params: {
|
|
7181
|
+
names: { type: "array", description: "Tool names to describe (omit for all tools)", items: { type: "string" } }
|
|
7182
|
+
},
|
|
7183
|
+
example: '{"names":["memory_save","memory_recall"]}'
|
|
7184
|
+
}
|
|
7185
|
+
};
|
|
7186
|
+
var TOOL_REGISTRY = Object.entries(FULL_SCHEMAS).map(([name, schema]) => ({
|
|
7187
|
+
name,
|
|
7188
|
+
description: schema.description,
|
|
7189
|
+
category: schema.category
|
|
7190
|
+
}));
|
|
6863
7191
|
server.tool("search_tools", "Search available tools by name or keyword. Returns names only.", {
|
|
6864
7192
|
query: exports_external.string(),
|
|
6865
7193
|
category: exports_external.enum(["memory", "agent", "project", "bulk", "utility", "graph", "meta"]).optional()
|
|
@@ -6868,17 +7196,39 @@ server.tool("search_tools", "Search available tools by name or keyword. Returns
|
|
|
6868
7196
|
const results = TOOL_REGISTRY.filter((t) => (!args.category || t.category === args.category) && (t.name.includes(q) || t.description.toLowerCase().includes(q)));
|
|
6869
7197
|
if (results.length === 0)
|
|
6870
7198
|
return { content: [{ type: "text", text: "No tools found." }] };
|
|
6871
|
-
return { content: [{ type: "text", text: results.map((t) => `${t.name} [${t.category}]`).join(`
|
|
7199
|
+
return { content: [{ type: "text", text: results.map((t) => `${t.name} [${t.category}]: ${t.description}`).join(`
|
|
6872
7200
|
`) }] };
|
|
6873
7201
|
});
|
|
6874
|
-
server.tool("describe_tools", "Get full schemas for
|
|
6875
|
-
names: exports_external.array(exports_external.string())
|
|
7202
|
+
server.tool("describe_tools", "Get full parameter schemas and examples for tools. Omit names to list all tools.", {
|
|
7203
|
+
names: exports_external.array(exports_external.string()).optional()
|
|
6876
7204
|
}, async (args) => {
|
|
6877
|
-
const
|
|
6878
|
-
|
|
7205
|
+
const targets = args.names && args.names.length > 0 ? args.names : Object.keys(FULL_SCHEMAS);
|
|
7206
|
+
const results = targets.filter((name) => (name in FULL_SCHEMAS)).map((name) => {
|
|
7207
|
+
const schema = FULL_SCHEMAS[name];
|
|
7208
|
+
const paramLines = Object.entries(schema.params).map(([pname, p]) => {
|
|
7209
|
+
const req = p.required ? " [required]" : "";
|
|
7210
|
+
const enumStr = p.enum ? ` (${p.enum.join("|")})` : "";
|
|
7211
|
+
return ` ${pname}${req}: ${p.type}${enumStr} \u2014 ${p.description}`;
|
|
7212
|
+
});
|
|
7213
|
+
const lines = [
|
|
7214
|
+
`### ${name} [${schema.category}]`,
|
|
7215
|
+
schema.description
|
|
7216
|
+
];
|
|
7217
|
+
if (paramLines.length > 0) {
|
|
7218
|
+
lines.push("Params:", ...paramLines);
|
|
7219
|
+
} else {
|
|
7220
|
+
lines.push("Params: none");
|
|
7221
|
+
}
|
|
7222
|
+
if (schema.example)
|
|
7223
|
+
lines.push(`Example: ${schema.example}`);
|
|
7224
|
+
return lines.join(`
|
|
7225
|
+
`);
|
|
7226
|
+
});
|
|
7227
|
+
if (results.length === 0) {
|
|
6879
7228
|
return { content: [{ type: "text", text: "No matching tools." }] };
|
|
6880
|
-
|
|
6881
|
-
return { content: [{ type: "text", text:
|
|
7229
|
+
}
|
|
7230
|
+
return { content: [{ type: "text", text: results.join(`
|
|
7231
|
+
|
|
6882
7232
|
`) }] };
|
|
6883
7233
|
});
|
|
6884
7234
|
server.resource("memories", "mementos://memories", { description: "All active memories", mimeType: "application/json" }, async () => {
|