"""
tools.py
This file contains the actual Python functions that the LLM calls
whenever it invokes an MCP tool like `setParameter`.
These functions delegate the real work to juce_bridge.py,
which handles OSC/TCP communication with your JUCE synthesizer.
"""
from typing import Dict, Any
from . import juce_bridge
# ------------------------------------------------------------
# Tool function implementations
# ------------------------------------------------------------
def setParameter(param: str, value: float) -> Dict[str, Any]:
"""
Set a JUCE synth parameter.
"""
juce_bridge.set_parameter(param, value)
return {"ok": True, "message": f"Parameter '{param}' set to {value}"}
def getParameter(param: str) -> Dict[str, Any]:
"""
Query a JUCE synth parameter.
"""
val = juce_bridge.get_parameter(param)
return {"value": val}
def listParameters() -> Dict[str, Any]:
"""
List all known parameters. Ultimately you may want this to query JUCE directly.
For now it's static or read from config.
"""
params = juce_bridge.list_parameters()
return {"parameters": params}
# ------------------------------------------------------------
# Tool registry that mcp_server.py imports
# ------------------------------------------------------------
TOOL_FUNCTIONS = {
"setParameter": setParameter,
"getParameter": getParameter,
"listParameters": listParameters,
}