Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/keboola_agent_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Keboola Agent CLI - AI-friendly interface to Keboola projects."""

__version__ = "0.6.5"
__version__ = "0.6.6"
41 changes: 13 additions & 28 deletions src/keboola_agent_cli/commands/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,41 +207,26 @@ def tool_call(
)
raise typer.Exit(code=2) from None

# Validate required parameters before calling tool across all projects
# Validate + call in a single MCP session (eliminates double subprocess spawn)
try:
missing, known_tools = service.validate_tool_input(
tool_name=tool_name,
tool_input=parsed_input,
aliases=[project] if project else None,
branch_id=branch_str,
)
except ConfigError as exc:
formatter.error(message=exc.message, error_code="CONFIG_ERROR")
raise typer.Exit(code=5) from None

if missing:
params_str = ", ".join(missing)
example_json = json.dumps({p: "..." for p in missing})
formatter.error(
message=(
f"Missing required parameter(s) for '{tool_name}': {params_str}. "
f"Use: kbagent tool call {tool_name} --input '{example_json}'"
),
error_code="MISSING_PARAMETER",
)
raise typer.Exit(code=2) from None

try:
result = service.call_tool(
result = service.validate_and_call_tool(
tool_name=tool_name,
tool_input=parsed_input,
alias=project,
branch_id=branch_str,
_known_tools=known_tools,
)
except ConfigError as exc:
formatter.error(message=exc.message, error_code="CONFIG_ERROR")
raise typer.Exit(code=5) from None
# ConfigError covers: unknown tool, missing params, config issues
error_code = "CONFIG_ERROR"
exit_code = 5
if "Missing required parameter" in exc.message:
error_code = "MISSING_PARAMETER"
exit_code = 2
elif "Unknown MCP tool" in exc.message:
error_code = "CONFIG_ERROR"
exit_code = 5
formatter.error(message=exc.message, error_code=error_code)
raise typer.Exit(code=exit_code) from None

if formatter.json_mode:
formatter.output(result)
Expand Down
9 changes: 9 additions & 0 deletions src/keboola_agent_cli/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
# 0 = unlimited (all projects run in parallel); set KBAGENT_MCP_MAX_SESSIONS to throttle
DEFAULT_MCP_MAX_SESSIONS: int = 0

# --- MCP HTTP Transport ---
# Transport mode: "http" (persistent server) or "stdio" (subprocess per call)
ENV_MCP_TRANSPORT: str = "KBAGENT_MCP_TRANSPORT"
DEFAULT_MCP_TRANSPORT: str = "stdio"
# Timeout for the persistent MCP server to start and be healthy
MCP_SERVER_STARTUP_TIMEOUT: float = 15.0
# Timeout for health check requests to persistent MCP server
MCP_SERVER_HEALTH_TIMEOUT: float = 2.0

# --- Storage Job Polling ---
STORAGE_JOB_POLL_INTERVAL: float = 1.0 # seconds between polls
STORAGE_JOB_MAX_WAIT: float = 60.0 # max seconds to wait for a storage job
Expand Down
Loading