This commit is contained in:
Rishi Gupta 2026-10-05 16:02:50 +08:00 • committed by GitHub
commit f6e183ed6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 3 deletions

View file

@ -48,7 +48,7 @@ Your assistant chooses these tools automatically. Use this table when you need t
| --- | --- | --- | --- |
| `search_memory` | Semantic recall from one space | `query` (required), `containerTag` | Matching memories |
| `get_profile` | Stable and recent profile context for one space | `containerTag` | Profile facts |
| `add_memory` | Save information or forget outdated information | `content` (required), `action` (`save` or `forget`), `containerTag` | Save or forget confirmation |
| `add_memory` | Save information or forget outdated information | `content` (required), `action` (`save` or `forget`), `containerTag`, optional `metadata` | Save or forget confirmation |
| `list_documents` | Browse stored source documents and their summaries | `page`, `limit`, `containerTag` | Document IDs, titles, types, status, dates, and summaries |
| `get_document` | Read the available content of one document | `documentId` (required) | Document metadata, summary, and available content |
| `list_memories` | Browse recent extracted memory entries and their source document IDs | `page`, `limit`, `containerTag` | Memory IDs, text, versions, and source document IDs |

View file

@ -22,12 +22,14 @@ describeWithAuth("MCP - space scoping", () => {
const plainTools = (await plain.client.listTools()).tools
expect(propsOf(plainTools, "add_memory")).toHaveProperty("containerTag")
expect(propsOf(plainTools, "add_memory")).toHaveProperty("metadata")
expect(propsOf(plainTools, "search_memory")).toHaveProperty(
"containerTag",
)
expect(propsOf(plainTools, "get_profile")).toHaveProperty("containerTag")
expect(propsOf(scopedTools, "add_memory")).toHaveProperty("containerTag")
expect(propsOf(scopedTools, "add_memory")).toHaveProperty("metadata")
expect(propsOf(scopedTools, "search_memory")).toHaveProperty(
"containerTag",
)

View file

@ -161,12 +161,13 @@ export class SupermemoryClient {
async createMemory(
content: string,
metadata?: Record<string, unknown>,
): Promise<{ id: string; status: string; containerTag: string }> {
try {
const result = await this.client.add({
content,
containerTag: this.containerTag,
metadata: { sm_source: MCP_SOURCE },
metadata: { ...metadata, sm_source: MCP_SOURCE },
})
return {
id: result.id,

View file

@ -12,6 +12,7 @@ export function register(deps: ToolDeps) {
.describe("The memory content to save or forget"),
action: z.enum(["save", "forget"]).optional().default("save"),
containerTag: optionalContainerTagSchema,
metadata: z.record(z.string(), z.unknown()).optional().describe("Optional metadata to attach to the saved memory"),
})
deps.server.registerTool(
@ -42,7 +43,7 @@ export function register(deps: ToolDeps) {
}
}
const result = await client.createMemory(args.content)
const result = await client.createMemory(args.content, args.metadata)
const message = `Memory saved (ID: ${result.id}, space: ${result.containerTag})`
const structuredContent: AddMemoryOutput = {
action: "save",