Open Context Protocol is live! 🚀 Read the launch post

searchTopics

Search topics

Details

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

Parameters

{
  "q": {
    "description": "The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as the web interface for GitHub. 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"
  },
  "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": "Topic Search Result Item",
        "description": "Topic Search Result Item",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "display_name": {
            "type": "string",
            "nullable": true
          },
          "short_description": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "created_by": {
            "type": "string",
            "nullable": true
          },
          "released": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "featured": {
            "type": "boolean"
          },
          "curated": {
            "type": "boolean"
          },
          "score": {
            "type": "number"
          },
          "repository_count": {
            "type": "integer",
            "nullable": true
          },
          "logo_url": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "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"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "related": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "object",
              "properties": {
                "topic_relation": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "topic_id": {
                      "type": "integer"
                    },
                    "relation_type": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "aliases": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "object",
              "properties": {
                "topic_relation": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "topic_id": {
                      "type": "integer"
                    },
                    "relation_type": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "required": [
          "name",
          "display_name",
          "short_description",
          "description",
          "created_by",
          "released",
          "created_at",
          "updated_at",
          "featured",
          "curated",
          "score"
        ]
      }
    }
  }
}

Usage

from ocp_agent import OCPAgent

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

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