Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

6.7 KB
Raw Blame
# MCP tool definitions. Tools are opt-in: an operation is exposed only when it has an entry here.
# List operations without an entry: pnpm --filter=@posthog/mcp run scaffold-yaml -- --candidates --product review_hog
# Add one: pnpm --filter=@posthog/mcp run scaffold-yaml -- --add <operationId> --product review_hog
# To keep an operation off on purpose, set enabled: false and give a disabled_reason.
category: PostHog Review
feature: review_hog
url_prefix: /code-review
ui_apps: {}
tools:
    review-hog-reviews-get:
        operation: review_hog_reviews_retrieve
        enabled: true
        scopes:
            - review_hog:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Get a code review
        description: >
            Fetch one code review by `id` (from `review-hog-reviews-list` or the trigger's `report_id`). It returns the
            last completed turn: its validated `findings` (each with file, line ranges, priority, and the suggested
            fix), the `dismissed_findings` the validator dropped and why, and the `report_markdown` published to the PR.
            While a re-review runs, the findings are still the previous turn's. A first review that is still running has
            no detail yet, so poll `review-hog-reviews-list` until it completes.
        feature_flag: review-hog
    review-hog-reviews-list:
        operation: review_hog_reviews_list
        enabled: true
        scopes:
            - review_hog:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        list: true
        title: List code reviews
        description: >
            List recent code reviews on this project. Use it to poll a review's status. Running reviews come first, each
            with `in_progress: true` and a `progress` object (the running turn's `review_stage` plus `done`/`total`
            counters). Completed reviews follow, newest first, with their finding counts by priority (`must_fix_count`,
            `should_fix_count`, `consider_count`) and whether they were `published`. Each row's `id` opens the full
            review with `review-hog-reviews-get`. The default `scope=mine` covers reviews you ran plus reviews of pull
            requests you authored. Pass `scope=everyone` for every review on the project, and `limit` to widen the page.
        feature_flag: review-hog
    review-hog-reviews-pr-status:
        operation: review_hog_reviews_pr_status_retrieve
        enabled: true
        scopes:
            - review_hog:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Get a pull request's review status
        description: >
            Look up where a pull request's review runs stand, by `pr_url`. Works for any PR on the project, also ones
            you did not trigger. `state` is `not_reviewed`, `queued`, `reviewing`, `resolving`, `idle`, or `unknown`.
            `latest_review` sums up the latest completed turn (its `id`, `run_index`, `review_mode`, `head_sha` and
            finding counts by priority), and `latest_resolution` the latest Resolve run. The loop for a run you started:
            call `review-hog-reviews-trigger`, keep the `requested_at` it returns and the `run_mode` you sent, and poll
            this tool with them (a minute apart is enough) until `request_outcome.status` is not `pending`. On
            `completed`, call `review-hog-reviews-get` with `request_outcome.review_id` and `run_index` for the
            findings; a Deep turn also answers a Standard request. `skipped` and `failed` carry a `reason`, for example
            `flash_after_full`, `review_failed`, or `no_matching_run` (nothing ran for the request and nothing is
            queued, so trigger again). `unknown` means the run state could not be read: retry later.
        feature_flag: review-hog
    review-hog-reviews-trigger:
        operation: review_hog_reviews_trigger_create
        enabled: true
        scopes:
            - review_hog:write
        annotations:
            readOnly: false
            destructive: false
            idempotent: false
        title: Trigger a code review
        description: >
            Start a PostHog Review run on a pull request. Pass the PR as `pr_url` (e.g.
            `https://github.com/PostHog/posthog/pull/123`). The repository must be accessible to the project's GitHub
            App installation. `run_mode` picks the variant: `review` (the default) is a Deep review, published to the
            PR, followed by the Resolve stage; `review_only` is a Deep review without Resolve; `flash` is a Standard
            review on a lower-cost model that never resolves; `resolve_only` skips the review and only works the PR's
            existing unresolved review threads. Resolve runs only when the pull request owner opted in to resolving
            comments, not the requester. The owner is the PR author, or the Inbox reviewer for a PR the PostHog app
            opened. The response's `resolve_will_run` says whether Resolve will run, and `resolve_skip_reason` says why
            not. IMPORTANT: Resolve writes to the PR itself. It may push signed fix commits to the PR's branch, reply to
            review threads, and resolve bot-authored threads. Nothing is deleted and the commits are plain appends, but
            the actions are public to everyone on the PR. Non-blocking: returns `status` `started`, with `repository`,
            `pr_number`, the `head_sha` the request targets, `review_mode`, `requested_at`, and `report_id` (null on the
            PR's first run; find it later with `review-hog-reviews-list`). If the PR's current commit already has a
            published review in the requested mode, it returns `already_reviewed` without starting a run (`resolve_only`
            skips that check). A request while a review runs is queued on that PR's run and returns
            `joined_running_review`. Refusals: 409 with `code` `flash_after_full` (the PR has a Deep review, so ask for
            `review` instead) or `resolution_not_opted_in` (`resolve_only` on a PR whose owner did not opt in); 409
            without a code while Resolve runs on the PR, or while a review runs for a `resolve_only` request. To wait
            for the result, poll `review-hog-reviews-pr-status` with `pr_url`, `requested_at` and `head_sha` from this
            response and the `run_mode` you sent, until `request_outcome.status` is not `pending` (`unknown` means retry
            later), then read the findings with `review-hog-reviews-get` using its `review_id` and `run_index`. An
            `already_reviewed` response needs no polling.
        feature_flag: review-hog