execute
Facilitates actions on Jentic's MCP server by executing specified operations or workflows using provided UUIDs and input parameters.
Instructions
Perform the chosen action for the user using the provided details (if any are needed).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| execution_type | Yes | Specify whether to execute an 'operation' or a 'workflow'. | |
| inputs | Yes | The input parameters required by the operation or workflow. | |
| uuid | Yes | The UUID of the operation or workflow to execute. |
Input Schema (JSON Schema)
{
"properties": {
"execution_type": {
"description": "Specify whether to execute an 'operation' or a 'workflow'.",
"enum": [
"operation",
"workflow"
],
"type": "string"
},
"inputs": {
"additionalProperties": true,
"description": "The input parameters required by the operation or workflow.",
"type": "object"
},
"uuid": {
"description": "The UUID of the operation or workflow to execute.",
"type": "string"
}
},
"required": [
"execution_type",
"uuid",
"inputs"
],
"type": "object"
}
Implementation Reference
- mcp/src/mcp/adapters/mcp.py:137-193 (handler)The primary handler for the 'execute' MCP tool. It validates inputs, constructs an ExecutionRequest, delegates to the Jentic client's execute method, and formats the response with success/error handling and suggested next actions.async def execute(self, params: dict[str, Any]) -> dict[str, Any]: """MCP endpoint for executing an operation or workflow. Args: params: MCP tool request parameters containing execution_type, uuid, and inputs. Returns: MCP tool response with the execution result. """ logger = logging.getLogger(__name__) id = params.get("uuid") inputs = params.get("inputs", {}) if not id: logger.error(f"Invalid id: {id}") return {"result": {"success": False, "message": "Invalid id. Must be 'op_' or 'wf_'."}} if not isinstance(inputs, dict): logger.error(f"Invalid inputs type: {type(inputs)}. Must be a dictionary.") return {"result": {"success": False, "message": "Invalid inputs type. Must be a dictionary."}} logger.info(f"Executing {id} with inputs: {inputs}") try: execution_request = ExecutionRequest( id=id, inputs=inputs, ) exec_response: ExecuteResponse = await self.jentic.execute(execution_request) if not exec_response.success: return { "result": { "success": False, "message": exec_response.error or "Execution failed.", "output": exec_response.model_dump(exclude_none=True), "suggested_next_actions": self.get_execute_tool_failure_suggested_next_actions(), } } return { "result": { "success": True, "output": exec_response.output, } } except Exception as e: logger.error(f"Error executing {id}: {str(e)}", exc_info=True) return { "result": { "success": False, "message": f"Error during execution: {str(e)}", "suggested_next_actions": self.get_execute_tool_failure_suggested_next_actions() } }
- mcp/src/mcp/tools.py:77-100 (schema)JSON schema defining the input parameters for the 'execute' tool: execution_type (operation/workflow), uuid, and inputs object.EXECUTE_TOOL = { "name": "execute", "description": "Perform the chosen action for the user using the provided details. Always include `inputs` even if there are none.", "parameters": { "type": "object", "properties": { "execution_type": { "type": "string", "enum": ["operation", "workflow"], "description": "Specify whether to execute an 'operation' or a 'workflow'.", }, "uuid": { "type": "string", "description": "The UUID of the operation or workflow to execute.", }, "inputs": { "type": "object", "description": "The input parameters required by the operation or workflow.", "additionalProperties": True, }, }, "required": ["execution_type", "uuid", "inputs"], }, }
- mcp/src/mcp/handlers.py:45-50 (registration)Maps the 'execute' tool name to the MCPAdapter.execute handler method in the central tool dispatch dictionary.tool_handlers = { "search_apis": mcp_adapter.search_api_capabilities, "load_execution_info": mcp_adapter.generate_runtime_config, "execute": mcp_adapter.execute, # Add the execute tool handler "submit_feedback": mcp_adapter.submit_feedback }