get_cell_protocol
Retrieve memory behavior templates for cognitive systems, specifying protocols like key_value, windowed, or episodic to structure data storage and access patterns.
Instructions
Returns a cell protocol template describing memory behaviors.
Args:
name: Identifier of the cell protocol (key_value, windowed, episodic).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | cell.protocol.key_value |
Implementation Reference
- The main MCP tool handler for 'get_cell_protocol', decorated with @mcp.tool() for automatic registration. Validates input, calls helper to fetch template, returns it or lists available protocols.@mcp.tool() def get_cell_protocol(name: str = "cell.protocol.key_value") -> str: """ Returns a cell protocol template describing memory behaviors. Args: name: Identifier of the cell protocol (key_value, windowed, episodic). """ try: model = CellProtocolInput(name=name) except ValidationError as e: return f"Input Validation Error: {e}" template = get_cell_protocol_template(model.name) if template: return template available = ", ".join(sorted(CELL_PROTOCOL_REGISTRY.keys())) return ( f"// Cell protocol '{model.name}' not found. Available protocols: {available}" )
- Pydantic input schema for the get_cell_protocol tool, validating the 'name' parameter.class CellProtocolInput(BaseModel): name: str = Field( "cell.protocol.key_value", min_length=1, description="Cell protocol name." )
- Helper function used by the handler to retrieve cell protocol templates from the registry.def get_cell_protocol_template(name: str) -> Optional[str]: """Return a cell protocol template by identifier. Args: name: Protocol key such as 'cell.protocol.key_value'. Returns: The corresponding template string if registered. """ return CELL_PROTOCOL_REGISTRY.get(name)
- Registry dictionary mapping protocol names to their template strings, used by get_cell_protocol_template.CELL_PROTOCOL_REGISTRY: Final[Dict[str, str]] = { "cell.protocol.key_value": CELL_PROTOCOL_KEY_VALUE, "cell.protocol.windowed": CELL_PROTOCOL_WINDOWED, "cell.protocol.episodic": CELL_PROTOCOL_EPISODIC, }