openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.06 kB
JavaScript
import{Type}from"typebox";
//!extensions/xai/code-execution-tool-shared.ts
const CodeExecutionParameters=Type.Object({task:Type.String({description:`The full analysis task for xAI's remote Python sandbox. Include any data to analyze directly in the task.`})});function buildMissingCodeExecutionApiKeyPayload(){return{error:`missing_xai_api_key`,message:"code_execution needs xAI credentials. Run `openclaw onboard --auth-choice xai-oauth` to sign in with Grok, run `openclaw onboard --auth-choice xai-api-key`, set `XAI_API_KEY` in the Gateway environment, or configure `plugins.entries.xai.config.webSearch.apiKey`.",docs:`https://docs.openclaw.ai/tools/code-execution`}}function createCodeExecutionToolDefinition(e){return{label:`Code Execution`,name:`code_execution`,description:`Run sandboxed Python analysis with xAI. Use for calculations, tabulation, summaries, and chart-style analysis without local machine access.`,parameters:CodeExecutionParameters,execute:e}}export{createCodeExecutionToolDefinition as n,buildMissingCodeExecutionApiKeyPayload as t};