Open Context Protocol is live! 🚀 Read the launch post

getComments

Get comments

Details

  • Method: GET
  • Path: /rest/api/3/issue/{issueIdOrKey}/comment
  • Operation ID: getComments

Parameters

{
  "issueIdOrKey": {
    "description": "The ID or key of the issue.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "startAt": {
    "description": "The index of the first item to return in a page of results (page offset).",
    "required": false,
    "location": "query",
    "type": "integer",
    "format": "int64"
  },
  "maxResults": {
    "description": "The maximum number of items to return per page.",
    "required": false,
    "location": "query",
    "type": "integer",
    "format": "int32"
  },
  "orderBy": {
    "description": "[Order](#ordering) the results by a field. Accepts *created* to sort comments by their created date.",
    "required": false,
    "location": "query",
    "type": "string",
    "enum": [
      "created",
      "-created",
      "+created"
    ]
  },
  "expand": {
    "description": "Use [expand](#expansion) to include additional information about comments in the response. This parameter accepts `renderedBody`, which returns the comment body rendered in HTML.",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "additionalProperties": true,
  "description": "A page of comments.",
  "properties": {
    "comments": {
      "description": "The list of comments.",
      "items": {
        "additionalProperties": true,
        "description": "A comment.",
        "properties": {
          "author": {
            "allOf": [
              {
                "$ref": "#/components/schemas/UserDetails"
              }
            ],
            "description": "The ID of the user who created the comment.",
            "readOnly": true
          },
          "body": {
            "description": "The comment text in [Atlassian Document Format](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/)."
          },
          "created": {
            "description": "The date and time at which the comment was created.",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
          },
          "id": {
            "description": "The ID of the comment.",
            "readOnly": true,
            "type": "string"
          },
          "jsdAuthorCanSeeRequest": {
            "description": "Whether the comment was added from an email sent by a person who is not part of the issue. See [Allow external emails to be added as comments on issues](https://support.atlassian.com/jira-service-management-cloud/docs/allow-external-emails-to-be-added-as-comments-on-issues/)for information on setting up this feature.",
            "readOnly": true,
            "type": "boolean"
          },
          "jsdPublic": {
            "description": "Whether the comment is visible in Jira Service Desk. Defaults to true when comments are created in the Jira Cloud Platform. This includes when the site doesn't use Jira Service Desk or the project isn't a Jira Service Desk project and, therefore, there is no Jira Service Desk for the issue to be visible on. To create a comment with its visibility in Jira Service Desk set to false, use the Jira Service Desk REST API [Create request comment](https://developer.atlassian.com/cloud/jira/service-desk/rest/#api-rest-servicedeskapi-request-issueIdOrKey-comment-post) operation.",
            "readOnly": true,
            "type": "boolean"
          },
          "properties": {
            "description": "A list of comment properties. Optional on create and update.",
            "items": {
              "additionalProperties": false,
              "description": "An entity property, for more information see [Entity properties](https://developer.atlassian.com/cloud/jira/platform/jira-entity-properties/).",
              "properties": {
                "key": {
                  "description": "The key of the property. Required on create and update.",
                  "type": "string"
                },
                "value": {
                  "description": "The value of the property. Required on create and update."
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "renderedBody": {
            "description": "The rendered version of the comment.",
            "readOnly": true,
            "type": "string"
          },
          "self": {
            "description": "The URL of the comment.",
            "readOnly": true,
            "type": "string"
          },
          "updateAuthor": {
            "allOf": [
              {
                "$ref": "#/components/schemas/UserDetails"
              }
            ],
            "description": "The ID of the user who updated the comment last.",
            "readOnly": true
          },
          "updated": {
            "description": "The date and time at which the comment was updated last.",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
          },
          "visibility": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Visibility"
              }
            ],
            "description": "The group or role to which this comment is visible. Optional on create and update."
          }
        },
        "type": "object"
      },
      "readOnly": true,
      "type": "array"
    },
    "maxResults": {
      "description": "The maximum number of items that could be returned.",
      "format": "int32",
      "readOnly": true,
      "type": "integer"
    },
    "startAt": {
      "description": "The index of the first item returned.",
      "format": "int64",
      "readOnly": true,
      "type": "integer"
    },
    "total": {
      "description": "The number of items returned.",
      "format": "int64",
      "readOnly": true,
      "type": "integer"
    }
  },
  "type": "object"
}

Usage

from ocp_agent import OCPAgent

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

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