Skip to content

Memory API

Memory Server

doc_processing_std_tools.memory

Memory tools MCP server.

Provides persistent key-value and file-based memory that survives across agent sessions. Both interfaces operate on the same underlying storage directory (DPTTOOLS_MEMORY_DIR).

Key-value tools store each key as a .json file. File-based tools work with arbitrary files (markdown, text, etc.) within the memory directory.

delete_memory(key)

Delete a memory entry.

Parameters:

Name Type Description Default
key str

The memory key to delete.

required

Returns:

Type Description
str

Confirmation message.

list_memory_keys()

List all stored memory keys.

Returns:

Type Description
str

JSON list of all memory keys.

memory_create(path, file_text)

Create a new memory file. Fails if the file already exists.

Parameters:

Name Type Description Default
path str

Relative path within the memory directory.

required
file_text str

Content for the new file.

required

Returns:

Type Description
str

Confirmation message.

memory_delete(path)

Delete a memory file or directory (and all its contents).

Parameters:

Name Type Description Default
path str

Relative path within the memory directory.

required

Returns:

Type Description
str

Confirmation message.

memory_insert(path, insert_line, insert_text)

Insert text at a specific line in a memory file (0-based line number).

Line 0 inserts before the first line. A line number equal to the file's line count appends to the end.

Parameters:

Name Type Description Default
path str

Relative path within the memory directory.

required
insert_line int

0-based line number to insert at.

required
insert_text str

Text to insert.

required

Returns:

Type Description
str

Confirmation message.

memory_rename(old_path, new_path)

Rename or move a memory file within the memory directory.

Parameters:

Name Type Description Default
old_path str

Current relative path within the memory directory.

required
new_path str

New relative path within the memory directory.

required

Returns:

Type Description
str

Confirmation message.

memory_str_replace(path, old_str, new_str)

Replace text in a memory file. The old_str must appear exactly once.

Parameters:

Name Type Description Default
path str

Relative path within the memory directory.

required
old_str str

Exact text to find (must appear exactly once).

required
new_str str

Replacement text.

required

Returns:

Type Description
str

Confirmation message.

memory_view(path, view_range=None)

View a memory directory listing or file contents with line numbers.

If the path points to a directory, lists its contents (like ls). If the path points to a file, shows its contents with 1-indexed line numbers. Use view_range to show only a specific range of lines.

Parameters:

Name Type Description Default
path str

Relative path within the memory directory. Use / or "" for the root of the memory directory.

required
view_range list[int] | None

Optional [start_line, end_line] (1-indexed) to view only those lines.

None

Returns:

Type Description
str

Directory listing or file contents with line numbers.

read_memory(key)

Retrieve a value from long-term memory by key.

Parameters:

Name Type Description Default
key str

The memory key to look up.

required

Returns:

Type Description
str

The stored value, or an error message if not found.

search_memory(query)

Search memory for matching keys and values (case-insensitive substring).

Scans all .json memory files and returns entries where either the key or value contains the query string.

Parameters:

Name Type Description Default
query str

Search string to match against keys and values.

required

Returns:

Type Description
str

JSON list of matching memory entries.

write_memory(key, value)

Store a value in long-term memory.

The key is used as the filename (with .json extension) inside the memory directory. Overwrites any existing value for the same key.

Parameters:

Name Type Description Default
key str

The memory key (used as filename).

required
value str

The value to store.

required

Returns:

Type Description
str

Confirmation message.