Open Context Protocol is live! 🚀 Read the launch post

addGadget

Add gadget to dashboard

Details

  • Method: POST
  • Path: /rest/api/3/dashboard/{dashboardId}/gadget
  • Operation ID: addGadget

Parameters

{
  "dashboardId": {
    "description": "The ID of the dashboard.",
    "required": true,
    "location": "path",
    "type": "integer",
    "format": "int64"
  },
  "color": {
    "description": "The color of the gadget. Should be one of `blue`, `red`, `yellow`, `green`, `cyan`, `purple`, `gray`, or `white`.",
    "required": false,
    "location": "body",
    "type": "string"
  },
  "ignoreUriAndModuleKeyValidation": {
    "description": "Whether to ignore the validation of module key and URI. For example, when a gadget is created that is a part of an application that isn't installed.",
    "required": false,
    "location": "body",
    "type": "boolean"
  },
  "moduleKey": {
    "description": "The module key of the gadget type. Can't be provided with `uri`.",
    "required": false,
    "location": "body",
    "type": "string"
  },
  "position": {
    "description": "The position of the gadget. When the gadget is placed into the position, other gadgets in the same column are moved down to accommodate it.",
    "required": false,
    "location": "body",
    "type": "string"
  },
  "title": {
    "description": "The title of the gadget.",
    "required": false,
    "location": "body",
    "type": "string"
  },
  "uri": {
    "description": "The URI of the gadget type. Can't be provided with `moduleKey`.",
    "required": false,
    "location": "body",
    "type": "string"
  }
}

Response Schema

{
  "additionalProperties": false,
  "description": "Details of a gadget.",
  "properties": {
    "color": {
      "description": "The color of the gadget. Should be one of `blue`, `red`, `yellow`, `green`, `cyan`, `purple`, `gray`, or `white`.",
      "enum": [
        "blue",
        "red",
        "yellow",
        "green",
        "cyan",
        "purple",
        "gray",
        "white"
      ],
      "readOnly": true,
      "type": "string"
    },
    "id": {
      "description": "The ID of the gadget instance.",
      "format": "int64",
      "readOnly": true,
      "type": "integer"
    },
    "moduleKey": {
      "description": "The module key of the gadget type.",
      "readOnly": true,
      "type": "string"
    },
    "position": {
      "allOf": [
        {
          "$ref": "#/components/schemas/DashboardGadgetPosition"
        }
      ],
      "description": "The position of the gadget.",
      "readOnly": true
    },
    "title": {
      "description": "The title of the gadget.",
      "readOnly": true,
      "type": "string"
    },
    "uri": {
      "description": "The URI of the gadget type.",
      "readOnly": true,
      "type": "string"
    }
  },
  "required": [
    "color",
    "id",
    "position",
    "title"
  ],
  "type": "object"
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('jira')

# Call this tool
result = await agent.call_tool('addGadget', {
    # Add required parameters here
})