Skip to content

editor_toolset.toolsets.programmatic.ProgrammaticToolset

Batches calls to other registered tools through a small sandboxed Python script that glues them together with custom logic. The script's purpose is tool orchestration, not general Python execution.

2 tool(s).

editor_toolset.toolsets.programmatic.ProgrammaticToolset.execute_tool_script

Execute a Python script against the toolset APIs.

    Use this to batch multiple tool calls into a single script execution,
    reducing round-trips and context usage.

    IMPORTANT: Available modules and usage instructions are described by the
    value returned by `get_execution_environment`. You MUST call
    `get_execution_environment` once in the conversation before using this
    tool. Read the value in the `instructions` field in the returned
    environment info prior to calling this function, so that you understand
    what APIs are available and how to use them.

    Before writing a script that calls multiple tools, look up the output
    schemas (if available) for any tools you plan to use. This returns the
    JSON schema describing each tool's return value, so you know how to
    parse results and pass data between calls.

    Args:
        script: Python script to execute. Must define a `run()` function
            that returns a `Dict[str, Any]`.

    Returns:
        JSON-encoded dict returned by the script's `run()` function.

    Raises:
        SyntaxError: If the script has invalid syntax.
        ValueError: If the script imports a disallowed module or does not
            define a `run()` function.
        TypeError: If `run()` does not return a dict.
        Exception: Any unhandled exception raised by the script.

Input schema

{
  "properties": {
    "script": {
      "type": "string"
    }
  },
  "required": [
    "script"
  ],
  "type": "object"
}

Output schema

{
  "properties": {
    "returnValue": {
      "description": "Value of the result.",
      "type": "string"
    }
  },
  "required": [
    "returnValue"
  ],
  "type": "object"
}

editor_toolset.toolsets.programmatic.ProgrammaticToolset.get_execution_environment

Get details about execution environment.

    This includes instructions on how to write scripts, and constraints,
    such as what modules may be imported and the script entrypoint and
    function signature.

    Returns:
        Returns the current execution environment.

Input schema

{
  "type": "object"
}

Output schema

{
  "properties": {
    "returnValue": {
      "properties": {
        "instructions": {
          "type": "string"
        },
        "language": {
          "type": "string"
        },
        "supported_modules": {
          "items": {
            "properties": {
              "description": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "description",
              "name"
            ],
            "title": "ProgrammaticApiSupportedModule",
            "type": "object"
          },
          "type": "array"
        }
      },
      "required": [
        "instructions",
        "supported_modules",
        "language"
      ],
      "title": "ProgrammaticApiExecutionEnvironmentInfo",
      "type": "object"
    }
  },
  "required": [
    "returnValue"
  ],
  "type": "object"
}