2025-03-16 17:17:01 +08:00
# ifndef HUMANUS_TOOL_PYTHON_EXECUTE_H
# define HUMANUS_TOOL_PYTHON_EXECUTE_H
# include "base.h"
2025-03-19 18:44:54 +08:00
# include "mcp_client.h"
2025-03-16 17:17:01 +08:00
namespace humanus {
2025-03-28 17:57:20 +08:00
struct PythonExecute : BaseMCPTool {
2025-03-16 17:17:01 +08:00
inline static const std : : string name_ = " python_execute " ;
inline static const std : : string description_ = " Executes Python code string. Note: Only print outputs are visible, function return values are not captured. Use print statements to see results. " ;
inline static const json parameters_ = {
{ " type " , " object " } ,
{ " properties " , {
{ " code " , {
{ " type " , " string " } ,
2025-04-06 16:32:51 +08:00
{ " description " , " The Python code to execute. Note: Use absolute file paths if code will read/write files. " }
2025-03-16 17:17:01 +08:00
} } ,
{ " timeout " , {
{ " type " , " number " } ,
{ " description " , " The timeout for the Python code execution in seconds. " } ,
{ " default " , 5 }
} }
} } ,
{ " required " , { " code " } }
} ;
2025-03-28 17:57:20 +08:00
PythonExecute ( ) : BaseMCPTool ( name_ , description_ , parameters_ ) { }
2025-03-16 17:17:01 +08:00
} ;
}
# endif // HUMANUS_TOOL_PYTHON_EXECUTE_H