: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
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`generateToolCode with input_schema > applies enrich_url with input_schema 1`] = `
"
const ThingsCreateSchema = () => ThingCreateSchema
const thingsCreate = (): ToolBase<ReturnType<typeof ThingsCreateSchema>, unknown> => ({
name: 'things-create',
schema: ThingsCreateSchema(),
handler: async (context: Context, params: z.infer<ReturnType<typeof ThingsCreateSchema>>) => {
const projectId = await context.stateManager.getProjectId()
const parsedParams = ThingsCreateSchema().parse(params)
const result = await context.api.request<unknown>({
method: 'POST',
path: \`/api/projects/\${encodeURIComponent(String(projectId))}/things/\`,
body: parsedParams,
})
return await withPostHogUrl(context, result, \`/things/\${result.id}\`)
},
})
"
`;
exports[`generateToolCode with input_schema > applies list enrichment with input_schema 1`] = `
"
const ThingsListSchema = () => ThingListSchema
const thingsList = (): ToolBase<ReturnType<typeof ThingsListSchema>, unknown> => ({
name: 'things-list',
schema: ThingsListSchema(),
handler: async (context: Context, params: z.infer<ReturnType<typeof ThingsListSchema>>) => {
const projectId = await context.stateManager.getProjectId()
const parsedParams = ThingsListSchema().parse(params)
const result = await context.api.request<unknown>({
method: 'GET',
path: \`/api/projects/\${encodeURIComponent(String(projectId))}/things/\`,
query: parsedParams,
})
return await withPostHogUrl(context, {
...result,
results: await Promise.all((result.results ?? []).map((item) => withPostHogUrl(context, item, \`/things/\${item.id}\`))),
}, '/things')
},
})
"
`;
exports[`generateToolCode with input_schema > uses custom schema import when input_schema is set 1`] = `
"
const ThingsCreateSchema = () => ThingCreateSchema
const thingsCreate = (): ToolBase<ReturnType<typeof ThingsCreateSchema>, unknown> => ({
name: 'things-create',
schema: ThingsCreateSchema(),
handler: async (context: Context, params: z.infer<ReturnType<typeof ThingsCreateSchema>>) => {
const projectId = await context.stateManager.getProjectId()
const parsedParams = ThingsCreateSchema().parse(params)
const result = await context.api.request<unknown>({
method: 'POST',
path: \`/api/projects/\${encodeURIComponent(String(projectId))}/things/\`,
body: parsedParams,
})
return result
},
})
"
`;