memory

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements the Model Context Protocol (MCP) for memory operations. It provides memory-based operations through a restricted knowledge base, exposing standard memory operations as MCP tools.

Server ensures all operations remain within the configured knowledge base for security. It implements both the mcp.Server and mcp.ToolServer interfaces to provide memory functionality through the MCP protocol.

func NewServer

func NewServer(memoryFilePath string) Server

NewServer creates a new memory MCP server that provides access to the knowledge base at the specified memoryFilePath.

The server validates that the knowledge base exists and is a valid JSON file. All memory operations are restricted to this knowledge base and its contents for security.

func (Server) CallTool

func (s Server) CallTool(
	_ context.Context,
	params mcp.CallToolParams,
	_ mcp.ProgressReporter,
	_ mcp.RequestClientFunc,
) (mcp.CallToolResult, error)

CallTool implements mcp.ToolServer interface. Executes a specified memory tool with the given parameters. All operations are restricted to the knowledge base.

Returns the tool's execution result and any error encountered. Returns error if the tool is not found or if execution fails.

func (Server) ListTools

func (s Server) ListTools(
	context.Context,
	mcp.ListToolsParams,
	mcp.ProgressReporter,
	mcp.RequestClientFunc,
) (mcp.ListToolsResult, error)

ListTools implements mcp.ToolServer interface. Returns the list of available memory tools supported by this server. The tools provide various memory operations like creating, deleting, and searching entities and relations. This tool is essential for understanding memory structure and finding specific entities and relations. Only works within allowed knowledge bases.

Returns a ToolList containing all available memory tools and any error encountered.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL