Decorator-based registry to attach validation functions for tool calls and runtime validator that checks arguments before execution.
# Source: https://github.com/mperkins0155/MIRIX | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""
Tool argument validation registry.
Usage:
@register_validator("episodic_memory_insert", "episodic_memory_replace")
def validate_episodic_memory(function_name: str, args: dict) -> Optional[str]:
'''Returns error message if invalid, None if valid.'''
...
# In agent.py:
error = validate_tool_args(function_name, function_args)
if error:
# handle validation failure
"""
from typing import Callable, Dict, Optional
# Registry: tool_name -> validator_function
_VALIDATORS: Dict[str, Callable[[str, dict], Optional[str]]] = {}
def register_valida
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key