Open Context Protocol is live! 🚀 Read the launch post

searchLabels

Search labels

Details

  • Method: GET
  • Path: /search/labels
  • Operation ID: search/labels

Parameters

{
  "repository_id": {
    "description": "The id of the repository.",
    "required": true,
    "location": "query",
    "type": "integer"
  },
  "q": {
    "description": "The search keywords. This endpoint does not accept qualifiers in the query. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/search/search#constructing-a-search-query).",
    "required": true,
    "location": "query",
    "type": "string"
  },
  "sort": {
    "description": "Sorts the results of your query by when the label was `created` or `updated`. Default: [best match](https://docs.github.com/rest/search/search#ranking-search-results)",
    "required": false,
    "location": "query",
    "type": "string",
    "enum": [
      "created",
      "updated"
    ]
  },
  "order": {
    "description": "Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`.",
    "required": false,
    "location": "query",
    "type": "string",
    "enum": [
      "desc",
      "asc"
    ]
  },
  "per_page": {
    "description": "The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "page": {
    "description": "The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"",
    "required": false,
    "location": "query",
    "type": "integer"
  }
}

Response Schema

{
  "type": "object",
  "required": [
    "total_count",
    "incomplete_results",
    "items"
  ],
  "properties": {
    "total_count": {
      "type": "integer"
    },
    "incomplete_results": {
      "type": "boolean"
    },
    "items": {
      "type": "array",
      "items": {
        "title": "Label Search Result Item",
        "description": "Label Search Result Item",
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "node_id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "default": {
            "type": "boolean"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "score": {
            "type": "number"
          },
          "text_matches": {
            "title": "Search Result Text Matches",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object_url": {
                  "type": "string"
                },
                "object_type": {
                  "nullable": true,
                  "type": "string"
                },
                "property": {
                  "type": "string"
                },
                "fragment": {
                  "type": "string"
                },
                "matches": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string"
                      },
                      "indices": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "required": [
          "id",
          "node_id",
          "url",
          "name",
          "color",
          "default",
          "description",
          "score"
        ]
      }
    }
  }
}

Usage

from ocp_agent import OCPAgent

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

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