Open Context Protocol is live! 🚀 Read the launch post
reposUpdateWebhook

reposUpdateWebhook

Update a repository webhook

Details

  • Method: PATCH
  • Path: /repos/{owner}/{repo}/hooks/{hook_id}
  • Operation ID: repos/update-webhook

Parameters

{
  "owner": {
    "description": "The account owner of the repository. The name is not case sensitive.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "repo": {
    "description": "The name of the repository without the `.git` extension. The name is not case sensitive.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "hook_id": {
    "description": "The unique identifier of the hook. You can find this value in the `X-GitHub-Hook-ID` header of a webhook delivery.",
    "required": true,
    "location": "path",
    "type": "integer"
  },
  "config": {
    "description": "Configuration object of the webhook",
    "required": false,
    "location": "body",
    "type": "object"
  },
  "events": {
    "description": "Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. This replaces the entire array of events.",
    "required": false,
    "location": "body",
    "type": "array"
  },
  "add_events": {
    "description": "Determines a list of events to be added to the list of events that the Hook triggers for.",
    "required": false,
    "location": "body",
    "type": "array"
  },
  "remove_events": {
    "description": "Determines a list of events to be removed from the list of events that the Hook triggers for.",
    "required": false,
    "location": "body",
    "type": "array"
  },
  "active": {
    "description": "Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications.",
    "required": false,
    "location": "body",
    "type": "boolean"
  }
}

Response Schema

{
  "title": "Webhook",
  "description": "Webhooks for repositories.",
  "type": "object",
  "properties": {
    "type": {
      "type": "string"
    },
    "id": {
      "description": "Unique identifier of the webhook.",
      "example": 42,
      "type": "integer"
    },
    "name": {
      "description": "The name of a valid service, use 'web' for a webhook.",
      "example": "web",
      "type": "string"
    },
    "active": {
      "description": "Determines whether the hook is actually triggered on pushes.",
      "type": "boolean",
      "example": true
    },
    "events": {
      "description": "Determines what events the hook is triggered for. Default: ['push'].",
      "type": "array",
      "items": {
        "type": "string"
      },
      "example": [
        "push",
        "pull_request"
      ]
    },
    "config": {
      "title": "Webhook Configuration",
      "description": "Configuration object of the webhook",
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "The URL to which the payloads will be delivered.",
          "example": "https://example.com/webhook",
          "format": "uri"
        },
        "content_type": {
          "type": "string",
          "description": "The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`.",
          "example": "\"json\""
        },
        "secret": {
          "type": "string",
          "description": "If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/webhooks/event-payloads/#delivery-headers).",
          "example": "\"********\""
        },
        "insecure_ssl": {
          "oneOf": [
            {
              "type": "string",
              "description": "Determines whether the SSL certificate of the host for `url` will be verified when delivering payloads. Supported values include `0` (verification is performed) and `1` (verification is not performed). The default is `0`. **We strongly recommend not setting this to `1` as you are subject to man-in-the-middle and other attacks.**",
              "example": "\"0\""
            },
            {
              "type": "number"
            }
          ]
        }
      }
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "example": "2011-09-06T20:39:23Z"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "example": "2011-09-06T17:26:27Z"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "example": "https://api.github.com/repos/octocat/Hello-World/hooks/1"
    },
    "test_url": {
      "type": "string",
      "format": "uri",
      "example": "https://api.github.com/repos/octocat/Hello-World/hooks/1/test"
    },
    "ping_url": {
      "type": "string",
      "format": "uri",
      "example": "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings"
    },
    "deliveries_url": {
      "type": "string",
      "format": "uri",
      "example": "https://api.github.com/repos/octocat/Hello-World/hooks/1/deliveries"
    },
    "last_response": {
      "title": "Hook Response",
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "nullable": true
        },
        "status": {
          "type": "string",
          "nullable": true
        },
        "message": {
          "type": "string",
          "nullable": true
        }
      },
      "required": [
        "code",
        "status",
        "message"
      ]
    }
  },
  "required": [
    "id",
    "url",
    "type",
    "name",
    "active",
    "events",
    "config",
    "ping_url",
    "created_at",
    "updated_at",
    "last_response",
    "test_url"
  ]
}

Usage

from ocp_agent import OCPAgent

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

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