Documentation
¶
Index ¶
Constants ¶
const CacheDirEnv = "LEANPROXY_TOOLCACHE_DIR"
CacheDirEnv overrides the persistent tool cache directory. Tests (and operators who want the cache elsewhere) set it; when unset the cache lives in $HOME/.config/leanproxy/toolcache.
const CacheValidDuration = 24 * time.Hour
Variables ¶
This section is empty.
Functions ¶
func DefaultCacheDir ¶ added in v1.1.1
DefaultCacheDir returns the persistent tool cache directory: the LEANPROXY_TOOLCACHE_DIR environment variable when set, otherwise $HOME/.config/leanproxy/toolcache. $HOME is honored (os.UserHomeDir) so a test that points HOME at a scratch directory never touches the real one.
Types ¶
type Cache ¶
type Cache interface {
GetTools(serverName string) ([]CachedTool, error)
SetTools(serverName string, tools []CachedTool) error
Invalidate(serverName string) error
GetCacheDir() string
}
type CachedTool ¶
type CachedTool struct {
Name string `json:"name"`
Title string `json:"title,omitempty"`
Description string `json:"description"`
InputSchema json.RawMessage `json:"inputSchema"`
OutputSchema json.RawMessage `json:"outputSchema,omitempty"`
Annotations json.RawMessage `json:"annotations,omitempty"`
Icons json.RawMessage `json:"icons,omitempty"`
Meta json.RawMessage `json:"_meta,omitempty"`
}
CachedTool is one persisted tool definition. The MCP 2025 metadata fields are optional, so cache files written before they existed still load.
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
func NewFileCache ¶
NewFileCache creates the persistent tool cache in DefaultCacheDir.
func (*FileCache) GetCacheDir ¶
func (*FileCache) Invalidate ¶
func (*FileCache) ListCachedServers ¶
type NoOpCache ¶
type NoOpCache struct{}
func NewNoOpCache ¶
func NewNoOpCache() *NoOpCache