get_tool

The active tool of the viewport with its descriptor, the open session (or null) and every tool tool_set can pick.

Query

Usage

TypeScript
surface.query('get_tool', { viewport? })

Parameters

  • viewportstring

    the host's viewport id; default: the engine's first viewport

    Optional

Returns

object with viewport, active, session, tools, in the ok: true envelope.

JSON
{
  "type": "object",
  "properties": {
    "viewport": {
      "type": "string"
    },
    "active": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "phases": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "hint": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "required": [
              "hint",
              "text"
            ]
          }
        },
        "creates": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "wantsHits": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "phases",
        "creates",
        "wantsHits"
      ]
    },
    "session": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "number"
        },
        "tool": {
          "type": "string"
        },
        "phase": {
          "type": "number"
        },
        "phases": {
          "type": "number"
        },
        "canCommit": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "tool",
        "phase",
        "phases",
        "canCommit"
      ]
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "phases": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "hint": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              },
              "required": [
                "hint",
                "text"
              ]
            }
          },
          "creates": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "wantsHits": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "phases",
          "creates",
          "wantsHits"
        ]
      }
    }
  },
  "required": [
    "viewport",
    "active",
    "session",
    "tools"
  ]
}

See also