: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
/**
* Auto-generated from the Django backend OpenAPI schema.
* MCP service uses these Zod schemas for generated tool handlers.
* To regenerate: hogli build:openapi
*
* PostHog API - MCP 4 enabled ops
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
/**
* Recent code reviews on this project: actively running reviews first (with the in-flight turn's stage), then the most recent completed ones — at most `limit` rows (default 5), plus `has_more` for whether a larger `limit` would reveal more. By default only the requesting user's reviews; `scope=everyone` lists every review on the project.
* @summary List recent reviews
*/
export const ReviewHogReviewsListParams = () => zod.object({
project_id: zod
.string()
.describe(
"Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
),
})
export const reviewHogReviewsListQueryLimitDefault = 5
export const reviewHogReviewsListQueryLimitMax = 100
export const reviewHogReviewsListQueryScopeDefault = `mine`
export const ReviewHogReviewsListQueryParams = () => zod.object({
limit: zod
.number()
.min(1)
.max(reviewHogReviewsListQueryLimitMax)
.default(reviewHogReviewsListQueryLimitDefault)
.describe(
'Maximum rows to return. The list grows this instead of paging by offset — in-progress rows reorder the list between refreshes, so offset pages would shift under the reader.'
),
scope: zod
.enum(['mine', 'everyone'])
.default(reviewHogReviewsListQueryScopeDefault)
.describe(
'Whose reviews to list: `mine` (the default) for reviews the requesting user ran plus reviews of pull requests they authored (matched via their linked GitHub login), `everyone` for every review on this project.\n\n\* `mine` - mine\n\* `everyone` - everyone'
),
})
/**
* One completed code review on this project, with one turn's validated findings, the findings the validator dismissed (and why), and the review body published to GitHub. The latest completed turn by default; `run_index` reads an older one. `in_progress`, `progress`, and the resolution fields describe the report now, whatever the turn. Project-wide, so reviews listed under `scope=everyone` can be opened too.
* @summary Retrieve one review's detail
*/
export const ReviewHogReviewsRetrieveParams = () => zod.object({
id: zod.string().describe('A UUID string identifying this review report.'),
project_id: zod
.string()
.describe(
"Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
),
})
export const ReviewHogReviewsRetrieveQueryParams = () => zod.object({
run_index: zod
.number()
.optional()
.describe(
"The completed review turn to read, from 1 to `run_count`. Defaults to the latest completed turn. Use it to read an older turn's findings."
),
})
/**
* Where a pull request's review runs stand: `state`, the latest completed review turn, and the latest Resolve run. Works for any pull request on the project, also ones the caller did not trigger. Pass the `requested_at` and `head_sha` the trigger returned, and the `run_mode` it was called with, to get `request_outcome`, which says when that request is done.
* @summary Look up a pull request's review status
*/
export const ReviewHogReviewsPrStatusRetrieveParams = () => zod.object({
project_id: zod
.string()
.describe(
"Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
),
})
export const reviewHogReviewsPrStatusRetrieveQueryRunModeDefault = `review`
export const ReviewHogReviewsPrStatusRetrieveQueryParams = () => zod.object({
head_sha: zod
.string()
.min(1)
.optional()
.describe(
'The `head_sha` the trigger returned. Lets a turn that was already running on that head when the request came in answer the request. Only used with `requested_at`.'
),
pr_url: zod
.string()
.min(1)
.describe("GitHub pull request URL to look up, e.g. 'https:\/\/github.com\/PostHog\/posthog\/pull\/123'."),
requested_at: zod.iso
.datetime({ offset: true })
.optional()
.describe(
'The `requested_at` the trigger returned. When set, the response carries `request_outcome` for that request.'
),
run_mode: zod
.enum(['review', 'review_only', 'resolve_only', 'flash'])
.default(reviewHogReviewsPrStatusRetrieveQueryRunModeDefault)
.describe(
"The `run_mode` the trigger was called with (default 'review'). Only used with `requested_at`.\n\n\* `review` - Review\n\* `review_only` - Review only\n\* `resolve_only` - Resolve only\n\* `flash` - Standard"
),
})
/**
* Start a PostHog Review run on any pull request the project's GitHub App installation can access, and publish it back to the PR. The run appears under the requesting user's recent reviews. A Deep review uses the requester's enabled perspectives, blind-spot check, validator, and urgency threshold; a Standard review uses none of them. Resolution writes to the branch only when the pull request owner opted in, whoever asks. `run_mode` picks the variant: 'review' is a Deep review that chains the resolution stage per the owner's resolve_comments setting, 'review_only' is a Deep review without resolving, 'resolve_only' runs resolution only, and 'flash' is a lower-cost Standard review that never resolves comments and is refused after a published Deep review. Nonexistent, closed, and fork PRs are rejected synchronously. A PR whose current commit already has a published review in the requested mode returns 'already_reviewed' without starting a run (resolve_only skips that check, because settling threads on a reviewed head is its whole point). A request while a review runs is queued on that PR's run. Otherwise non-blocking: returns immediately with the PR's head, the review's id when one exists, and whether resolution will run, while the run executes in the worker.
* @summary Start a review of a pull request
*/
export const ReviewHogReviewsTriggerCreateParams = () => zod.object({
project_id: zod
.string()
.describe(
"Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
),
})
export const reviewHogReviewsTriggerCreateBodyRunModeDefault = `review`
export const ReviewHogReviewsTriggerCreateBody = () => zod.object({
pr_url: zod
.string()
.describe(
"GitHub pull request URL to review, e.g. 'https:\/\/github.com\/PostHog\/posthog.com\/pull\/123'. The repository must be accessible to the project's GitHub App installation."
),
run_mode: zod
.enum(['review', 'review_only', 'resolve_only', 'flash'])
.describe(
'\* `review` - Review\n\* `review_only` - Review only\n\* `resolve_only` - Resolve only\n\* `flash` - Standard'
)
.default(reviewHogReviewsTriggerCreateBodyRunModeDefault)
.describe(
"What to run on the pull request. 'review' (default) reviews it and, when the pull request owner's resolve_comments setting is on, chains the resolution stage; 'review_only' reviews without resolving regardless of that setting; 'resolve_only' skips the review and only runs the resolution stage on the PR's existing unresolved review threads, which needs the owner's opt-in; 'flash' runs a Standard review: a lower-cost model for the review passes and validation, never resolves comments, and is refused once the PR has a published Deep review. The owner is the PR's author, or the Inbox reviewer of a pull request the PostHog app opened.\n\n\* `review` - Review\n\* `review_only` - Review only\n\* `resolve_only` - Resolve only\n\* `flash` - Standard"
),
})