MCPcopy Create free account
hub / github.com/GCWing/BitFun / validate_tool_input

Function validate_tool_input

src/apps/desktop/src/api/tool_api.rs:303–331  ·  view source on GitHub ↗
(
    request: ToolValidationRequest,
)

Source from the content-addressed store, hash-verified

301
302#[tauri::command]
303pub async fn validate_tool_input(
304 request: ToolValidationRequest,
305) -> Result<ToolValidationResponse, String> {
306 let tools = get_all_tools().await;
307
308 for tool in tools {
309 if tool.name() == request.tool_name {
310 ensure_workspace_requirement(
311 &request.tool_name,
312 &request.input,
313 request.workspace_path.as_deref(),
314 )?;
315
316 let context = build_tool_context(request.workspace_path.as_deref()).await;
317
318 let validation_result = tool.validate_input(&request.input, Some(&context)).await;
319
320 return Ok(ToolValidationResponse {
321 tool_name: request.tool_name,
322 valid: validation_result.result,
323 message: validation_result.message,
324 error_code: validation_result.error_code,
325 meta: validation_result.meta,
326 });
327 }
328 }
329
330 Err(format!("Tool '{}' not found", request.tool_name))
331}
332
333#[tauri::command]
334pub async fn execute_tool(request: ToolExecutionRequest) -> Result<ToolExecutionResponse, String> {

Callers

nothing calls this directly

Calls 5

get_all_toolsFunction · 0.85
build_tool_contextFunction · 0.85
nameMethod · 0.45
validate_inputMethod · 0.45

Tested by

no test coverage detected