mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-27 06:15:15 +00:00
feat(mcp): support optional metadata in add_memory and save-memory tools (#1817)
This commit is contained in:
parent
8200e7f27d
commit
cec177a7a3
1 changed files with 5 additions and 1 deletions
|
|
@ -13,6 +13,10 @@ export function register(deps: ToolDeps) {
|
|||
description: "Save content to memory",
|
||||
inputSchema: z.object({
|
||||
content: z.string().min(1),
|
||||
metadata: z
|
||||
.record(z.string(), z.unknown())
|
||||
.optional()
|
||||
.describe("Optional key-value metadata to attach to the memory"),
|
||||
namespace: namespaceSchema.optional(),
|
||||
...legacyNamespaceInput,
|
||||
viewId: z.string().uuid().optional(),
|
||||
|
|
@ -28,7 +32,7 @@ export function register(deps: ToolDeps) {
|
|||
return deps.errorResult(new Error("namespace is required"))
|
||||
const viewId = args.viewId ?? crypto.randomUUID()
|
||||
const client = deps.getClient(namespace)
|
||||
const result = await client.createMemory(args.content)
|
||||
const result = await client.createMemory(args.content, args.metadata)
|
||||
const sc: ViewMessage = withLegacyView({
|
||||
view: "save-success",
|
||||
viewId,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue