@scitrera/memorylayer-mcp-server 0.0.5 → 0.2.0
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/LICENSE +177 -0
- package/README.md +14 -2
- package/dist/src/client.d.ts +82 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +172 -8
- package/dist/src/client.js.map +1 -1
- package/dist/src/handlers.d.ts +15 -0
- package/dist/src/handlers.d.ts.map +1 -1
- package/dist/src/handlers.js +185 -3
- package/dist/src/handlers.js.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +17 -2
- package/dist/src/server.js.map +1 -1
- package/dist/src/tools.d.ts +1297 -150
- package/dist/src/tools.d.ts.map +1 -1
- package/dist/src/tools.js +559 -3
- package/dist/src/tools.js.map +1 -1
- package/dist/src/types.d.ts +5 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +8 -4
- package/examples/client-usage.ts +0 -93
- package/tests/server.test.ts +0 -130
- package/tests/session.test.ts +0 -152
- package/tests/tools.test.ts +0 -191
- package/vitest.config.ts +0 -15
package/dist/src/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE1B,CAAC"}
|
package/dist/src/tools.js
CHANGED
|
@@ -38,6 +38,26 @@ export const TOOLS = [
|
|
|
38
38
|
type: "string",
|
|
39
39
|
enum: ["solution", "problem", "code_pattern", "fix", "error", "workflow", "preference", "decision", "directive"],
|
|
40
40
|
description: "Optional domain-specific classification"
|
|
41
|
+
},
|
|
42
|
+
metadata: {
|
|
43
|
+
type: "object",
|
|
44
|
+
description: "Arbitrary memory metadata"
|
|
45
|
+
},
|
|
46
|
+
relations: {
|
|
47
|
+
type: "array",
|
|
48
|
+
description: "Explicit typed entity relations evidenced by this memory",
|
|
49
|
+
items: {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
source_entity_id: { type: "string" },
|
|
53
|
+
source_entity_name: { type: "string" },
|
|
54
|
+
target_entity_id: { type: "string" },
|
|
55
|
+
target_entity_name: { type: "string" },
|
|
56
|
+
relationship: { type: "string" },
|
|
57
|
+
confidence: { type: "number", minimum: 0, maximum: 1 }
|
|
58
|
+
},
|
|
59
|
+
required: ["relationship"]
|
|
60
|
+
}
|
|
41
61
|
}
|
|
42
62
|
},
|
|
43
63
|
required: ["content"]
|
|
@@ -78,6 +98,21 @@ export const TOOLS = [
|
|
|
78
98
|
type: "array",
|
|
79
99
|
items: { type: "string" },
|
|
80
100
|
description: "Filter by tags (AND logic)"
|
|
101
|
+
},
|
|
102
|
+
budget_tokens: {
|
|
103
|
+
type: "integer",
|
|
104
|
+
minimum: 1,
|
|
105
|
+
description: "Hard estimated-token budget for returned memory content"
|
|
106
|
+
},
|
|
107
|
+
include_confidence: {
|
|
108
|
+
type: "boolean",
|
|
109
|
+
default: true,
|
|
110
|
+
description: "Include deterministic retrieval-confidence metadata"
|
|
111
|
+
},
|
|
112
|
+
include_relations: {
|
|
113
|
+
type: "boolean",
|
|
114
|
+
default: true,
|
|
115
|
+
description: "Allow bounded typed-relation retrieval when enabled"
|
|
81
116
|
}
|
|
82
117
|
},
|
|
83
118
|
required: ["query"]
|
|
@@ -204,7 +239,7 @@ export const TOOLS = [
|
|
|
204
239
|
// Advanced tools
|
|
205
240
|
{
|
|
206
241
|
name: "memory_statistics",
|
|
207
|
-
description: "Get memory statistics and analytics for the workspace. Use to understand memory usage patterns.",
|
|
242
|
+
description: "Get memory statistics and analytics for the workspace. Use to understand memory usage patterns. (placeholder — not yet implemented; returns zero values)",
|
|
208
243
|
inputSchema: {
|
|
209
244
|
type: "object",
|
|
210
245
|
properties: {
|
|
@@ -255,7 +290,7 @@ export const TOOLS = [
|
|
|
255
290
|
},
|
|
256
291
|
{
|
|
257
292
|
name: "memory_audit",
|
|
258
|
-
description: "Audit memories for contradictions and inconsistencies. Use to maintain knowledge base health.",
|
|
293
|
+
description: "Audit memories for contradictions and inconsistencies. Use to maintain knowledge base health. (placeholder — not yet implemented; no audit is performed)",
|
|
259
294
|
inputSchema: {
|
|
260
295
|
type: "object",
|
|
261
296
|
properties: {
|
|
@@ -345,6 +380,54 @@ export const SESSION_TOOLS = [
|
|
|
345
380
|
properties: {}
|
|
346
381
|
}
|
|
347
382
|
},
|
|
383
|
+
{
|
|
384
|
+
name: "memory_session_checkpoint",
|
|
385
|
+
description: "Durably capture a raw transcript segment before compaction; derived indexing and enrichment never block raw capture.",
|
|
386
|
+
inputSchema: {
|
|
387
|
+
type: "object",
|
|
388
|
+
properties: {
|
|
389
|
+
transcript_segment: { type: "string", description: "Exact raw transcript segment to preserve" },
|
|
390
|
+
content_hash: { type: "string", description: "Lowercase SHA-256 digest of the UTF-8 segment" },
|
|
391
|
+
idempotency_key: { type: "string", description: "Stable key for safe retry" },
|
|
392
|
+
source_kind: { type: "string", default: "transcript" },
|
|
393
|
+
source_sequence: { type: "integer", minimum: 0 },
|
|
394
|
+
source_boundary: { type: "integer", minimum: 0 }
|
|
395
|
+
},
|
|
396
|
+
required: ["transcript_segment", "content_hash", "idempotency_key"]
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
name: "memory_context_pack",
|
|
401
|
+
description: "Build one deterministic, hard-budgeted session resume payload with directives, working memory, recent activity, contradictions, and checkpoint recovery.",
|
|
402
|
+
inputSchema: {
|
|
403
|
+
type: "object",
|
|
404
|
+
properties: {
|
|
405
|
+
topic: { type: "string", description: "Optional topic focus" },
|
|
406
|
+
entity_ids: { type: "array", items: { type: "string" } },
|
|
407
|
+
entity_names: { type: "array", items: { type: "string" } },
|
|
408
|
+
budget_tokens: { type: "integer", minimum: 32, default: 2048 },
|
|
409
|
+
section_limits: { type: "object", description: "Per-section item caps" },
|
|
410
|
+
include_directives: { type: "boolean", default: true },
|
|
411
|
+
include_working_memory: { type: "boolean", default: true },
|
|
412
|
+
include_recent_activity: { type: "boolean", default: true },
|
|
413
|
+
include_contradictions: { type: "boolean", default: true },
|
|
414
|
+
include_sandbox_summary: { type: "boolean", default: true },
|
|
415
|
+
include_checkpoint_recovery: { type: "boolean", default: true }
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
name: "memory_context_delta",
|
|
421
|
+
description: "Return collapsed context changes and tombstones since a signed context-pack cursor under a hard token budget.",
|
|
422
|
+
inputSchema: {
|
|
423
|
+
type: "object",
|
|
424
|
+
properties: {
|
|
425
|
+
cursor: { type: "string", description: "Cursor from a context pack or prior delta" },
|
|
426
|
+
budget_tokens: { type: "integer", minimum: 32, default: 2048 }
|
|
427
|
+
},
|
|
428
|
+
required: ["cursor"]
|
|
429
|
+
}
|
|
430
|
+
},
|
|
348
431
|
];
|
|
349
432
|
/**
|
|
350
433
|
* Context Environment tools for server-side sandbox execution.
|
|
@@ -557,6 +640,422 @@ export const CONTEXT_ENVIRONMENT_TOOLS = [
|
|
|
557
640
|
}
|
|
558
641
|
},
|
|
559
642
|
];
|
|
643
|
+
/**
|
|
644
|
+
* Chat history tools for storing and managing conversation threads.
|
|
645
|
+
*/
|
|
646
|
+
export const CHAT_TOOLS = [
|
|
647
|
+
{
|
|
648
|
+
name: "chat_thread_create",
|
|
649
|
+
description: "Create a new chat thread for storing conversation history. Threads persist messages over time and can auto-decompose into memories.",
|
|
650
|
+
inputSchema: {
|
|
651
|
+
type: "object",
|
|
652
|
+
properties: {
|
|
653
|
+
thread_id: { type: "string", description: "Client-provided thread ID (auto-generated if omitted)" },
|
|
654
|
+
user_id: { type: "string", description: "User who owns this conversation" },
|
|
655
|
+
observer_id: { type: "string", description: "Observer entity ID (typically the AI agent)" },
|
|
656
|
+
subject_id: { type: "string", description: "Subject entity ID (typically the human user)" },
|
|
657
|
+
title: { type: "string", description: "Optional display title" },
|
|
658
|
+
metadata: { type: "object", description: "Arbitrary metadata" }
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
name: "chat_thread_append",
|
|
664
|
+
description: "Append messages to a chat thread. Messages are stored persistently and will be decomposed into memories when threshold is reached.",
|
|
665
|
+
inputSchema: {
|
|
666
|
+
type: "object",
|
|
667
|
+
properties: {
|
|
668
|
+
thread_id: { type: "string", description: "Thread to append to" },
|
|
669
|
+
messages: {
|
|
670
|
+
type: "array",
|
|
671
|
+
items: {
|
|
672
|
+
type: "object",
|
|
673
|
+
properties: {
|
|
674
|
+
role: { type: "string", description: "Message role: user, assistant, system, tool" },
|
|
675
|
+
content: { description: "Message content (string or structured blocks)" },
|
|
676
|
+
metadata: { type: "object", description: "Optional metadata" }
|
|
677
|
+
},
|
|
678
|
+
required: ["role", "content"]
|
|
679
|
+
},
|
|
680
|
+
description: "Messages to append"
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
required: ["thread_id", "messages"]
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
name: "chat_thread_get",
|
|
688
|
+
description: "Get a chat thread with its messages. Returns thread metadata and paginated messages.",
|
|
689
|
+
inputSchema: {
|
|
690
|
+
type: "object",
|
|
691
|
+
properties: {
|
|
692
|
+
thread_id: { type: "string", description: "Thread ID to retrieve" },
|
|
693
|
+
limit: { type: "integer", default: 100, description: "Max messages to return" },
|
|
694
|
+
offset: { type: "integer", default: 0, description: "Message pagination offset" },
|
|
695
|
+
order: { type: "string", enum: ["asc", "desc"], default: "asc", description: "Message order" }
|
|
696
|
+
},
|
|
697
|
+
required: ["thread_id"]
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
name: "chat_thread_list",
|
|
702
|
+
description: "List chat threads in the workspace, optionally filtered by user.",
|
|
703
|
+
inputSchema: {
|
|
704
|
+
type: "object",
|
|
705
|
+
properties: {
|
|
706
|
+
user_id: { type: "string", description: "Filter by user ID" },
|
|
707
|
+
limit: { type: "integer", default: 50, description: "Max threads to return" },
|
|
708
|
+
offset: { type: "integer", default: 0, description: "Pagination offset" }
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
name: "chat_thread_decompose",
|
|
714
|
+
description: "Trigger memory decomposition for a thread's unprocessed messages. Extracts memories from chat history.",
|
|
715
|
+
inputSchema: {
|
|
716
|
+
type: "object",
|
|
717
|
+
properties: {
|
|
718
|
+
thread_id: { type: "string", description: "Thread to decompose" }
|
|
719
|
+
},
|
|
720
|
+
required: ["thread_id"]
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
name: "chat_thread_delete",
|
|
725
|
+
description: "Delete a chat thread and all its messages.",
|
|
726
|
+
inputSchema: {
|
|
727
|
+
type: "object",
|
|
728
|
+
properties: {
|
|
729
|
+
thread_id: { type: "string", description: "Thread to delete" }
|
|
730
|
+
},
|
|
731
|
+
required: ["thread_id"]
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
];
|
|
735
|
+
/**
|
|
736
|
+
* MCP tools for MCP server registry management.
|
|
737
|
+
*
|
|
738
|
+
* - mcp_servers_list = list registered MCP servers
|
|
739
|
+
* - mcp_servers_get = fetch a single server by ID or name
|
|
740
|
+
* - mcp_servers_save = create or update a server (upsert by name)
|
|
741
|
+
* - mcp_servers_delete = delete a server by ID
|
|
742
|
+
* - mcp_servers_import = bulk import from mcpServers JSON object
|
|
743
|
+
*/
|
|
744
|
+
export const MCP_SERVERS_TOOLS = [
|
|
745
|
+
{
|
|
746
|
+
name: "mcp_servers_list",
|
|
747
|
+
description: "List MCP servers registered in MemoryLayer. Returns name, transport, command/url, enabled status, and ID for each server. Use to discover what MCP servers are available in the workspace.",
|
|
748
|
+
inputSchema: {
|
|
749
|
+
type: "object",
|
|
750
|
+
properties: {
|
|
751
|
+
transport: {
|
|
752
|
+
type: "string",
|
|
753
|
+
enum: ["stdio", "http", "sse", "streamable-http"],
|
|
754
|
+
description: "Filter by transport type"
|
|
755
|
+
},
|
|
756
|
+
enabled: {
|
|
757
|
+
type: "boolean",
|
|
758
|
+
description: "Filter by enabled status (default: all servers)"
|
|
759
|
+
},
|
|
760
|
+
name: {
|
|
761
|
+
type: "string",
|
|
762
|
+
description: "Filter by exact server name"
|
|
763
|
+
},
|
|
764
|
+
limit: {
|
|
765
|
+
type: "integer",
|
|
766
|
+
minimum: 1,
|
|
767
|
+
maximum: 500,
|
|
768
|
+
default: 100,
|
|
769
|
+
description: "Maximum number of servers to return"
|
|
770
|
+
},
|
|
771
|
+
offset: {
|
|
772
|
+
type: "integer",
|
|
773
|
+
minimum: 0,
|
|
774
|
+
default: 0,
|
|
775
|
+
description: "Pagination offset"
|
|
776
|
+
}
|
|
777
|
+
},
|
|
778
|
+
required: []
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
name: "mcp_servers_get",
|
|
783
|
+
description: "Fetch a single MCP server record by ID or name. Returns full server details including transport, command/url, args, and metadata.",
|
|
784
|
+
inputSchema: {
|
|
785
|
+
type: "object",
|
|
786
|
+
properties: {
|
|
787
|
+
server_id: {
|
|
788
|
+
type: "string",
|
|
789
|
+
description: "Server ID (mcp_...) — use when you have the ID from mcp_servers_list"
|
|
790
|
+
},
|
|
791
|
+
name: {
|
|
792
|
+
type: "string",
|
|
793
|
+
description: "Server name — resolved by the server if server_id is not provided"
|
|
794
|
+
}
|
|
795
|
+
},
|
|
796
|
+
required: []
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
name: "mcp_servers_save",
|
|
801
|
+
description: "Create or update an MCP server record in MemoryLayer. If a server with the given name already exists it is updated; otherwise a new record is created. Env values and headers are stored as secrets.",
|
|
802
|
+
inputSchema: {
|
|
803
|
+
type: "object",
|
|
804
|
+
properties: {
|
|
805
|
+
name: {
|
|
806
|
+
type: "string",
|
|
807
|
+
description: "Server name (1-64 chars, lowercase letters/digits/hyphens)"
|
|
808
|
+
},
|
|
809
|
+
transport: {
|
|
810
|
+
type: "string",
|
|
811
|
+
enum: ["stdio", "http", "sse", "streamable-http"],
|
|
812
|
+
description: "Transport type: stdio (local process) or http/sse/streamable-http (remote)"
|
|
813
|
+
},
|
|
814
|
+
command: {
|
|
815
|
+
type: "string",
|
|
816
|
+
description: "Executable for stdio transport (e.g. 'npx', 'python')"
|
|
817
|
+
},
|
|
818
|
+
args: {
|
|
819
|
+
type: "array",
|
|
820
|
+
items: { type: "string" },
|
|
821
|
+
description: "Arguments for the command (stdio transport)"
|
|
822
|
+
},
|
|
823
|
+
env: {
|
|
824
|
+
type: "object",
|
|
825
|
+
additionalProperties: { type: "string" },
|
|
826
|
+
description: "Environment variables for the server process (stored as secrets)"
|
|
827
|
+
},
|
|
828
|
+
url: {
|
|
829
|
+
type: "string",
|
|
830
|
+
description: "URL for http/sse/streamable-http transport"
|
|
831
|
+
},
|
|
832
|
+
headers: {
|
|
833
|
+
type: "object",
|
|
834
|
+
additionalProperties: { type: "string" },
|
|
835
|
+
description: "HTTP headers for remote transport (stored as secrets)"
|
|
836
|
+
},
|
|
837
|
+
description: {
|
|
838
|
+
type: "string",
|
|
839
|
+
description: "Human-readable description of what this server provides"
|
|
840
|
+
},
|
|
841
|
+
enabled: {
|
|
842
|
+
type: "boolean",
|
|
843
|
+
default: true,
|
|
844
|
+
description: "Whether the server is enabled"
|
|
845
|
+
},
|
|
846
|
+
metadata: {
|
|
847
|
+
type: "object",
|
|
848
|
+
description: "Arbitrary metadata"
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
required: ["name", "transport"]
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
name: "mcp_servers_delete",
|
|
856
|
+
description: "Delete an MCP server record from MemoryLayer by ID.",
|
|
857
|
+
inputSchema: {
|
|
858
|
+
type: "object",
|
|
859
|
+
properties: {
|
|
860
|
+
server_id: {
|
|
861
|
+
type: "string",
|
|
862
|
+
description: "Server ID (mcp_...) to delete"
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
required: ["server_id"]
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
name: "mcp_servers_import",
|
|
870
|
+
description: "Bulk-import MCP servers from a mcpServers JSON object (the same format as .mcp.json / claude_desktop_config.json). Creates new records and updates existing ones by name. Returns counts of imported, updated, and any errors.",
|
|
871
|
+
inputSchema: {
|
|
872
|
+
type: "object",
|
|
873
|
+
properties: {
|
|
874
|
+
mcpServers: {
|
|
875
|
+
type: "object",
|
|
876
|
+
description: "Map of server name to server config (same schema as .mcp.json mcpServers field)",
|
|
877
|
+
additionalProperties: {
|
|
878
|
+
type: "object",
|
|
879
|
+
properties: {
|
|
880
|
+
command: { type: "string" },
|
|
881
|
+
args: { type: "array", items: { type: "string" } },
|
|
882
|
+
env: { type: "object", additionalProperties: { type: "string" } },
|
|
883
|
+
url: { type: "string" },
|
|
884
|
+
type: { type: "string" }
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
},
|
|
889
|
+
required: ["mcpServers"]
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
];
|
|
893
|
+
/**
|
|
894
|
+
* MCP tools for Agent Skills management.
|
|
895
|
+
*
|
|
896
|
+
* Implements the spec's progressive disclosure tiers:
|
|
897
|
+
* - skills_list = metadata tier (~100 tokens per skill)
|
|
898
|
+
* - skills_get = instructions tier (full SKILL.md, ≤5k tokens recommended)
|
|
899
|
+
* - skills_get_file = resources tier (on-demand file content)
|
|
900
|
+
* - skills_search = vector recall against skill memory mirror
|
|
901
|
+
* - skills_save = upsert a skill (full profile only)
|
|
902
|
+
*/
|
|
903
|
+
export const SKILLS_TOOLS = [
|
|
904
|
+
{
|
|
905
|
+
name: "skills_list",
|
|
906
|
+
description: "List available agent skills from MemoryLayer. Returns name, description, version, and scope for each skill. Use this to discover what skills are available before fetching details.",
|
|
907
|
+
inputSchema: {
|
|
908
|
+
type: "object",
|
|
909
|
+
properties: {
|
|
910
|
+
name: {
|
|
911
|
+
type: "string",
|
|
912
|
+
description: "Filter by exact skill name"
|
|
913
|
+
},
|
|
914
|
+
enabled: {
|
|
915
|
+
type: "boolean",
|
|
916
|
+
description: "Filter by enabled status (default: only enabled skills)"
|
|
917
|
+
},
|
|
918
|
+
include_shadowed: {
|
|
919
|
+
type: "boolean",
|
|
920
|
+
description: "Include skills shadowed by higher-scope skills with the same name"
|
|
921
|
+
},
|
|
922
|
+
limit: {
|
|
923
|
+
type: "integer",
|
|
924
|
+
minimum: 1,
|
|
925
|
+
maximum: 500,
|
|
926
|
+
default: 100,
|
|
927
|
+
description: "Maximum number of skills to return"
|
|
928
|
+
},
|
|
929
|
+
offset: {
|
|
930
|
+
type: "integer",
|
|
931
|
+
minimum: 0,
|
|
932
|
+
default: 0,
|
|
933
|
+
description: "Pagination offset"
|
|
934
|
+
}
|
|
935
|
+
},
|
|
936
|
+
required: []
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
name: "skills_get",
|
|
941
|
+
description: "Fetch the full SKILL.md body for a named skill. Returns frontmatter (name, description, version) plus the full instructions markdown. Use after skills_list to get actionable skill instructions.",
|
|
942
|
+
inputSchema: {
|
|
943
|
+
type: "object",
|
|
944
|
+
properties: {
|
|
945
|
+
skill_id: {
|
|
946
|
+
type: "string",
|
|
947
|
+
description: "Skill ID (skl_...) — use when you have the ID from skills_list"
|
|
948
|
+
},
|
|
949
|
+
name: {
|
|
950
|
+
type: "string",
|
|
951
|
+
description: "Skill name — resolved via the server if skill_id is not provided"
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
required: []
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
name: "skills_get_file",
|
|
959
|
+
description: "Fetch a single file from a skill's bundle (scripts, references, or assets). Returns text content or base64-encoded binary. Use for on-demand access to skill resources.",
|
|
960
|
+
inputSchema: {
|
|
961
|
+
type: "object",
|
|
962
|
+
properties: {
|
|
963
|
+
skill_id: {
|
|
964
|
+
type: "string",
|
|
965
|
+
description: "Skill ID (skl_...)"
|
|
966
|
+
},
|
|
967
|
+
path: {
|
|
968
|
+
type: "string",
|
|
969
|
+
description: "Relative file path within the skill bundle (e.g. scripts/extract.py)"
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
required: ["skill_id", "path"]
|
|
973
|
+
}
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
name: "skills_search",
|
|
977
|
+
description: "Search for skills by intent or description using vector recall. Use when you want to find a skill by what it does rather than its exact name (e.g. 'how do I extract tables from PDFs?').",
|
|
978
|
+
inputSchema: {
|
|
979
|
+
type: "object",
|
|
980
|
+
properties: {
|
|
981
|
+
query: {
|
|
982
|
+
type: "string",
|
|
983
|
+
description: "Natural language query describing the capability you need"
|
|
984
|
+
},
|
|
985
|
+
limit: {
|
|
986
|
+
type: "integer",
|
|
987
|
+
minimum: 1,
|
|
988
|
+
maximum: 50,
|
|
989
|
+
default: 10,
|
|
990
|
+
description: "Maximum number of candidate skills to return"
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
required: ["query"]
|
|
994
|
+
}
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
name: "skills_save",
|
|
998
|
+
description: "Create or update an agent skill in MemoryLayer. Stores the SKILL.md manifest and optional bundle files. The skill becomes available to all agents that share this MemoryLayer workspace.",
|
|
999
|
+
inputSchema: {
|
|
1000
|
+
type: "object",
|
|
1001
|
+
properties: {
|
|
1002
|
+
name: {
|
|
1003
|
+
type: "string",
|
|
1004
|
+
description: "Skill name (1-64 chars, lowercase letters/digits/hyphens, no leading/trailing/consecutive hyphens)"
|
|
1005
|
+
},
|
|
1006
|
+
description: {
|
|
1007
|
+
type: "string",
|
|
1008
|
+
description: "Skill description (1-1024 chars)"
|
|
1009
|
+
},
|
|
1010
|
+
body: {
|
|
1011
|
+
type: "string",
|
|
1012
|
+
description: "SKILL.md body markdown (the instructions, examples, usage)"
|
|
1013
|
+
},
|
|
1014
|
+
version: {
|
|
1015
|
+
type: "string",
|
|
1016
|
+
default: "0.1.0",
|
|
1017
|
+
description: "Skill version (semver-ish)"
|
|
1018
|
+
},
|
|
1019
|
+
license: {
|
|
1020
|
+
type: "string",
|
|
1021
|
+
description: "License identifier (e.g. MIT)"
|
|
1022
|
+
},
|
|
1023
|
+
compatibility: {
|
|
1024
|
+
type: "string",
|
|
1025
|
+
description: "Compatibility notes (max 500 chars)"
|
|
1026
|
+
},
|
|
1027
|
+
allowed_tools: {
|
|
1028
|
+
type: "string",
|
|
1029
|
+
description: "Space-separated tool allowlist (experimental spec field)"
|
|
1030
|
+
},
|
|
1031
|
+
source_mode: {
|
|
1032
|
+
type: "string",
|
|
1033
|
+
enum: ["server", "filesystem", "mirrored"],
|
|
1034
|
+
default: "server",
|
|
1035
|
+
description: "Where canonical storage lives"
|
|
1036
|
+
},
|
|
1037
|
+
metadata: {
|
|
1038
|
+
type: "object",
|
|
1039
|
+
description: "Arbitrary spec-allowed metadata"
|
|
1040
|
+
},
|
|
1041
|
+
files: {
|
|
1042
|
+
type: "array",
|
|
1043
|
+
items: {
|
|
1044
|
+
type: "object",
|
|
1045
|
+
properties: {
|
|
1046
|
+
path: { type: "string", description: "Relative path within skill bundle" },
|
|
1047
|
+
content_b64: { type: "string", description: "Base64-encoded file content" },
|
|
1048
|
+
mime_type: { type: "string", description: "MIME type (optional)" }
|
|
1049
|
+
},
|
|
1050
|
+
required: ["path", "content_b64"]
|
|
1051
|
+
},
|
|
1052
|
+
description: "Optional bundle files (scripts, references, assets)"
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
required: ["name", "description"]
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
];
|
|
560
1059
|
/**
|
|
561
1060
|
* Tool profiles for different use cases.
|
|
562
1061
|
*
|
|
@@ -581,6 +1080,9 @@ export const TOOL_NAMES = {
|
|
|
581
1080
|
sessionEnd: "memory_session_end",
|
|
582
1081
|
sessionCommit: "memory_session_commit",
|
|
583
1082
|
sessionStatus: "memory_session_status",
|
|
1083
|
+
sessionCheckpoint: "memory_session_checkpoint",
|
|
1084
|
+
contextPack: "memory_context_pack",
|
|
1085
|
+
contextDelta: "memory_context_delta",
|
|
584
1086
|
// Context environment (server-side sandbox)
|
|
585
1087
|
contextExec: "memory_context_exec",
|
|
586
1088
|
contextInspect: "memory_context_inspect",
|
|
@@ -590,6 +1092,25 @@ export const TOOL_NAMES = {
|
|
|
590
1092
|
contextRlm: "memory_context_rlm",
|
|
591
1093
|
contextStatus: "memory_context_status",
|
|
592
1094
|
contextCheckpoint: "memory_context_checkpoint",
|
|
1095
|
+
// Chat history
|
|
1096
|
+
chatThreadCreate: "chat_thread_create",
|
|
1097
|
+
chatThreadAppend: "chat_thread_append",
|
|
1098
|
+
chatThreadGet: "chat_thread_get",
|
|
1099
|
+
chatThreadList: "chat_thread_list",
|
|
1100
|
+
chatThreadDecompose: "chat_thread_decompose",
|
|
1101
|
+
chatThreadDelete: "chat_thread_delete",
|
|
1102
|
+
// Skills (agent harness knowledge units)
|
|
1103
|
+
skillsList: "skills_list",
|
|
1104
|
+
skillsGet: "skills_get",
|
|
1105
|
+
skillsGetFile: "skills_get_file",
|
|
1106
|
+
skillsSearch: "skills_search",
|
|
1107
|
+
skillsSave: "skills_save",
|
|
1108
|
+
// MCP server registry
|
|
1109
|
+
mcpServersList: "mcp_servers_list",
|
|
1110
|
+
mcpServersGet: "mcp_servers_get",
|
|
1111
|
+
mcpServersSave: "mcp_servers_save",
|
|
1112
|
+
mcpServersDelete: "mcp_servers_delete",
|
|
1113
|
+
mcpServersImport: "mcp_servers_import",
|
|
593
1114
|
};
|
|
594
1115
|
export const TOOL_PROFILES = {
|
|
595
1116
|
/**
|
|
@@ -617,6 +1138,9 @@ export const TOOL_PROFILES = {
|
|
|
617
1138
|
TOOL_NAMES.sessionEnd,
|
|
618
1139
|
TOOL_NAMES.sessionCommit,
|
|
619
1140
|
TOOL_NAMES.sessionStatus,
|
|
1141
|
+
TOOL_NAMES.sessionCheckpoint,
|
|
1142
|
+
TOOL_NAMES.contextPack,
|
|
1143
|
+
TOOL_NAMES.contextDelta,
|
|
620
1144
|
// Context environment
|
|
621
1145
|
TOOL_NAMES.contextExec,
|
|
622
1146
|
TOOL_NAMES.contextInspect,
|
|
@@ -626,6 +1150,16 @@ export const TOOL_PROFILES = {
|
|
|
626
1150
|
TOOL_NAMES.contextRlm,
|
|
627
1151
|
TOOL_NAMES.contextStatus,
|
|
628
1152
|
TOOL_NAMES.contextCheckpoint,
|
|
1153
|
+
// Chat history
|
|
1154
|
+
TOOL_NAMES.chatThreadCreate,
|
|
1155
|
+
TOOL_NAMES.chatThreadAppend,
|
|
1156
|
+
TOOL_NAMES.chatThreadGet,
|
|
1157
|
+
TOOL_NAMES.chatThreadList,
|
|
1158
|
+
// Skills (read-mostly: list, get, get_file, search)
|
|
1159
|
+
TOOL_NAMES.skillsList,
|
|
1160
|
+
TOOL_NAMES.skillsGet,
|
|
1161
|
+
TOOL_NAMES.skillsGetFile,
|
|
1162
|
+
TOOL_NAMES.skillsSearch,
|
|
629
1163
|
],
|
|
630
1164
|
/**
|
|
631
1165
|
* Full profile - all tools enabled
|
|
@@ -648,6 +1182,9 @@ export const TOOL_PROFILES = {
|
|
|
648
1182
|
TOOL_NAMES.sessionEnd,
|
|
649
1183
|
TOOL_NAMES.sessionCommit,
|
|
650
1184
|
TOOL_NAMES.sessionStatus,
|
|
1185
|
+
TOOL_NAMES.sessionCheckpoint,
|
|
1186
|
+
TOOL_NAMES.contextPack,
|
|
1187
|
+
TOOL_NAMES.contextDelta,
|
|
651
1188
|
// Context environment
|
|
652
1189
|
TOOL_NAMES.contextExec,
|
|
653
1190
|
TOOL_NAMES.contextInspect,
|
|
@@ -657,6 +1194,25 @@ export const TOOL_PROFILES = {
|
|
|
657
1194
|
TOOL_NAMES.contextRlm,
|
|
658
1195
|
TOOL_NAMES.contextStatus,
|
|
659
1196
|
TOOL_NAMES.contextCheckpoint,
|
|
1197
|
+
// Chat history
|
|
1198
|
+
TOOL_NAMES.chatThreadCreate,
|
|
1199
|
+
TOOL_NAMES.chatThreadAppend,
|
|
1200
|
+
TOOL_NAMES.chatThreadGet,
|
|
1201
|
+
TOOL_NAMES.chatThreadList,
|
|
1202
|
+
TOOL_NAMES.chatThreadDecompose,
|
|
1203
|
+
TOOL_NAMES.chatThreadDelete,
|
|
1204
|
+
// Skills (all 5 including save)
|
|
1205
|
+
TOOL_NAMES.skillsList,
|
|
1206
|
+
TOOL_NAMES.skillsGet,
|
|
1207
|
+
TOOL_NAMES.skillsGetFile,
|
|
1208
|
+
TOOL_NAMES.skillsSearch,
|
|
1209
|
+
TOOL_NAMES.skillsSave,
|
|
1210
|
+
// MCP server registry (all 5)
|
|
1211
|
+
TOOL_NAMES.mcpServersList,
|
|
1212
|
+
TOOL_NAMES.mcpServersGet,
|
|
1213
|
+
TOOL_NAMES.mcpServersSave,
|
|
1214
|
+
TOOL_NAMES.mcpServersDelete,
|
|
1215
|
+
TOOL_NAMES.mcpServersImport,
|
|
660
1216
|
],
|
|
661
1217
|
/**
|
|
662
1218
|
* Minimal profile - just the essentials
|
|
@@ -673,7 +1229,7 @@ export const DEFAULT_PROFILE = "cc";
|
|
|
673
1229
|
* Get tools for a given profile.
|
|
674
1230
|
*/
|
|
675
1231
|
export function getToolsForProfile(profile) {
|
|
676
|
-
const allTools = [...TOOLS, ...SESSION_TOOLS, ...CONTEXT_ENVIRONMENT_TOOLS];
|
|
1232
|
+
const allTools = [...TOOLS, ...SESSION_TOOLS, ...CONTEXT_ENVIRONMENT_TOOLS, ...CHAT_TOOLS, ...SKILLS_TOOLS, ...MCP_SERVERS_TOOLS];
|
|
677
1233
|
const enabledNames = TOOL_PROFILES[profile];
|
|
678
1234
|
return allTools.filter(tool => enabledNames.includes(tool.name));
|
|
679
1235
|
}
|