Open Context Protocol is live! 🚀 Read the launch post

getSpaces

Get spaces

Details

  • Method: GET
  • Path: /spaces
  • Operation ID: getSpaces

Parameters

{
  "ids": {
    "description": "Filter the results to spaces based on their IDs. Multiple IDs can be specified as a comma-separated list.",
    "required": false,
    "location": "query",
    "type": "array"
  },
  "keys": {
    "description": "Filter the results to spaces based on their keys. Multiple keys can be specified as a comma-separated list.",
    "required": false,
    "location": "query",
    "type": "array"
  },
  "type": {
    "description": "Filter the results to spaces based on their type.",
    "required": false,
    "location": "query",
    "type": "string",
    "enum": [
      "global",
      "collaboration",
      "knowledge_base",
      "personal",
      "system",
      "onboarding",
      "xflow_sample_space"
    ]
  },
  "status": {
    "description": "Filter the results to spaces based on their status.",
    "required": false,
    "location": "query",
    "type": "string",
    "enum": [
      "current",
      "archived"
    ]
  },
  "labels": {
    "description": "Filter the results to spaces based on their labels. Multiple labels can be specified as a comma-separated list.",
    "required": false,
    "location": "query",
    "type": "array"
  },
  "favorited-by": {
    "description": "Filter the results to spaces favorited by the user with the specified account ID.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "not-favorited-by": {
    "description": "Filter the results to spaces NOT favorited by the user with the specified account ID.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "sort": {
    "description": "Used to sort the result by a particular field.",
    "required": false,
    "location": "query",
    "type": "string",
    "enum": [
      "id",
      "-id",
      "key",
      "-key",
      "name",
      "-name"
    ]
  },
  "description-format": {
    "description": "The content format type to be returned in the `description` field of the response. If available, the representation will be available under a response field of the same name under the `description` field.",
    "required": false,
    "location": "query",
    "type": "string",
    "enum": [
      "plain",
      "view"
    ]
  },
  "include-icon": {
    "description": "If the icon for the space should be fetched or not.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "cursor": {
    "description": "Used for pagination, this opaque cursor will be returned in the `next` URL in the `Link` response header. Use the relative URL in the `Link` header to retrieve the `next` set of results.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "limit": {
    "description": "Maximum number of spaces per result to return. If more results exist, use the `Link` response header to retrieve a relative URL that will return the next set of results.",
    "required": false,
    "location": "query",
    "type": "integer",
    "format": "int32"
  }
}

Response Schema

{
  "title": "MultiEntityResult<Space>",
  "type": "object",
  "properties": {
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID of the space."
          },
          "key": {
            "type": "string",
            "description": "Key of the space."
          },
          "name": {
            "type": "string",
            "description": "Name of the space."
          },
          "type": {
            "enum": [
              "global",
              "collaboration",
              "knowledge_base",
              "personal",
              "system",
              "onboarding",
              "xflow_sample_space"
            ],
            "type": "string",
            "description": "The type of space."
          },
          "status": {
            "enum": [
              "current",
              "archived"
            ],
            "type": "string",
            "description": "The status of the space."
          },
          "authorId": {
            "type": "string",
            "description": "The account ID of the user who created this space originally."
          },
          "currentActiveAlias": {
            "type": "string",
            "description": "Currently active alias for a Confluence space."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Date and time when the space was created. In format \"YYYY-MM-DDTHH:mm:ss.sssZ\"."
          },
          "homepageId": {
            "type": "string",
            "description": "ID of the space's homepage."
          },
          "description": {
            "type": "object",
            "description": "Contains fields for each representation type requested.",
            "properties": {
              "plain": {
                "type": "object",
                "properties": {
                  "representation": {
                    "type": "string",
                    "description": "Type of content representation used for the value field."
                  },
                  "value": {
                    "type": "string",
                    "description": "Body of the content, in the format found in the representation field."
                  }
                }
              },
              "view": {
                "type": "object",
                "properties": {
                  "representation": {
                    "type": "string",
                    "description": "Type of content representation used for the value field."
                  },
                  "value": {
                    "type": "string",
                    "description": "Body of the content, in the format found in the representation field."
                  }
                }
              }
            }
          },
          "icon": {
            "type": "object",
            "description": "The icon of the space",
            "properties": {
              "path": {
                "type": "string",
                "description": "The path (relative to base URL) at which the space's icon can be retrieved. The format should be like `/wiki/download/...` or `/wiki/aa-avatar/...`"
              },
              "apiDownloadLink": {
                "type": "string",
                "description": "The path (relative to base URL) that can be used to retrieve a link to download the space icon. 3LO apps should use this link instead of the value provided\nin the `path` property to retrieve the icon.\n\nCurrently this field is only returned for `global` spaces and not `personal` spaces.\n"
              }
            }
          },
          "_links": {
            "type": "object",
            "properties": {
              "webui": {
                "type": "string",
                "description": "Web UI link of the space."
              }
            }
          }
        }
      }
    },
    "_links": {
      "type": "object",
      "properties": {
        "next": {
          "type": "string",
          "description": "Used for pagination. Contains the relative URL for the next set of results, using a cursor query parameter.\nThis property will not be present if there is no additional data available."
        },
        "base": {
          "type": "string",
          "description": "Base url of the Confluence site."
        }
      }
    }
  }
}

Usage

from ocp_agent import OCPAgent

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

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