: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 products/reminders/mcp/tools.yaml + OpenAPI — do not edit
import { z } from 'zod'
import type { Schemas } from '@/api/generated'
import * as orvalSchemas from '@/generated/reminders/api'
import { withPostHogUrl, type WithPostHogUrl } from '@/tools/tool-utils'
import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'
const ReminderCreateSchema = () => {
const RemindersCreateBody = orvalSchemas.RemindersCreateBody()
return RemindersCreateBody.extend({
organization: RemindersCreateBody.shape['organization']
.describe('Organization ID. If omitted, uses the active organization.')
.optional(),
})
}
const reminderCreate = (): ToolBase<ReturnType<typeof ReminderCreateSchema>, Schemas.Reminder> => ({
name: 'reminder-create',
schema: ReminderCreateSchema(),
handler: async (context: Context, params: z.infer<ReturnType<typeof ReminderCreateSchema>>) => {
const organization = params.organization ?? (await context.stateManager.getOrgID())
if (!organization) {
throw new Error('organization is required. Provide it explicitly or set an active organization first.')
}
const body: Record<string, unknown> = {}
body['organization'] = organization
if (params.team !== undefined) {
body['team'] = params.team
}
if (params.title !== undefined) {
body['title'] = params.title
}
if (params.message !== undefined) {
body['message'] = params.message
}
if (params.resource_type !== undefined) {
body['resource_type'] = params.resource_type
}
if (params.resource_id !== undefined) {
body['resource_id'] = params.resource_id
}
if (params.scheduled_at !== undefined) {
body['scheduled_at'] = params.scheduled_at
}
if (params.recurrence_interval !== undefined) {
body['recurrence_interval'] = params.recurrence_interval
}
if (params.cron_expression !== undefined) {
body['cron_expression'] = params.cron_expression
}
if (params.timezone !== undefined) {
body['timezone'] = params.timezone
}
if (params.end_date !== undefined) {
body['end_date'] = params.end_date
}
if (params.deleted !== undefined) {
body['deleted'] = params.deleted
}
const result = await context.api.request<Schemas.Reminder>({
method: 'POST',
path: `/api/reminders/`,
body,
})
return result
},
})
const ReminderDeleteSchema = () => {
const RemindersDestroyParams = orvalSchemas.RemindersDestroyParams()
return RemindersDestroyParams
}
const reminderDelete = (): ToolBase<ReturnType<typeof ReminderDeleteSchema>, Schemas.Reminder> => ({
name: 'reminder-delete',
schema: ReminderDeleteSchema(),
handler: async (context: Context, params: z.infer<ReturnType<typeof ReminderDeleteSchema>>) => {
const result = await context.api.request<Schemas.Reminder>({
method: 'PATCH',
path: `/api/reminders/${encodeURIComponent(String(params.id))}/`,
body: { deleted: true },
})
return result
},
})
const ReminderGetSchema = () => {
const RemindersRetrieveParams = orvalSchemas.RemindersRetrieveParams()
return RemindersRetrieveParams
}
const reminderGet = (): ToolBase<ReturnType<typeof ReminderGetSchema>, Schemas.Reminder> => ({
name: 'reminder-get',
schema: ReminderGetSchema(),
handler: async (context: Context, params: z.infer<ReturnType<typeof ReminderGetSchema>>) => {
const result = await context.api.request<Schemas.Reminder>({
method: 'GET',
path: `/api/reminders/${encodeURIComponent(String(params.id))}/`,
})
return result
},
})
const ReminderUpdateSchema = () => {
const RemindersPartialUpdateBody = orvalSchemas.RemindersPartialUpdateBody()
const RemindersPartialUpdateParams = orvalSchemas.RemindersPartialUpdateParams()
return RemindersPartialUpdateParams.extend(RemindersPartialUpdateBody.shape)
}
const reminderUpdate = (): ToolBase<ReturnType<typeof ReminderUpdateSchema>, Schemas.Reminder> => ({
name: 'reminder-update',
schema: ReminderUpdateSchema(),
handler: async (context: Context, params: z.infer<ReturnType<typeof ReminderUpdateSchema>>) => {
const body: Record<string, unknown> = {}
if (params.organization !== undefined) {
body['organization'] = params.organization
}
if (params.team !== undefined) {
body['team'] = params.team
}
if (params.title !== undefined) {
body['title'] = params.title
}
if (params.message !== undefined) {
body['message'] = params.message
}
if (params.resource_type !== undefined) {
body['resource_type'] = params.resource_type
}
if (params.resource_id !== undefined) {
body['resource_id'] = params.resource_id
}
if (params.scheduled_at !== undefined) {
body['scheduled_at'] = params.scheduled_at
}
if (params.recurrence_interval !== undefined) {
body['recurrence_interval'] = params.recurrence_interval
}
if (params.cron_expression !== undefined) {
body['cron_expression'] = params.cron_expression
}
if (params.timezone !== undefined) {
body['timezone'] = params.timezone
}
if (params.end_date !== undefined) {
body['end_date'] = params.end_date
}
if (params.deleted !== undefined) {
body['deleted'] = params.deleted
}
const result = await context.api.request<Schemas.Reminder>({
method: 'PATCH',
path: `/api/reminders/${encodeURIComponent(String(params.id))}/`,
body,
})
return result
},
})
const RemindersListSchema = () => {
const RemindersListQueryParams = orvalSchemas.RemindersListQueryParams()
return RemindersListQueryParams
}
const remindersList = (): ToolBase<
ReturnType<typeof RemindersListSchema>,
WithPostHogUrl<Schemas.PaginatedReminderList>
> => ({
name: 'reminders-list',
schema: RemindersListSchema(),
handler: async (context: Context, params: z.infer<ReturnType<typeof RemindersListSchema>>) => {
const result = await context.api.request<Schemas.PaginatedReminderList>({
method: 'GET',
path: `/api/reminders/`,
query: {
limit: params.limit,
offset: params.offset,
},
})
return await withPostHogUrl(context, result, '/')
},
})
export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'reminder-create': reminderCreate,
'reminder-delete': reminderDelete,
'reminder-get': reminderGet,
'reminder-update': reminderUpdate,
'reminders-list': remindersList,
}