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.

fix(mcp): add property definition test setup (#73495)

mendral-app[bot]0286ae6137e0
diff --git a/services/mcp/tests/tools/projects.integration.test.ts b/services/mcp/tests/tools/projects.integration.test.ts
index 1841b7d168e2..88dd29e3193a 100644
--- a/services/mcp/tests/tools/projects.integration.test.ts
+++ b/services/mcp/tests/tools/projects.integration.test.ts
@@ -147,6 +147,25 @@ describe('Projects', { concurrent: false }, () => {
describe('property-definition-update tool', () => {
const updateTool = updatePropertyDefinitionTool()
+ beforeAll(async () => {
+ // Ensure the $browser property definition exists before running update tests.
+ // In a fresh test environment no events have been ingested, so property
+ // definitions don't exist yet. We create one via the API if missing.
+ const searchResult = await context.api.request<{ results: { name: string }[] }>({
+ method: 'GET',
+ path: `/api/projects/${TEST_PROJECT_ID}/property_definitions/`,
+ query: { properties: '$browser', type: 'event' },
+ })
+ const exists = searchResult.results.some((def) => def.name === '$browser')
+ if (!exists) {
+ await context.api.request({
+ method: 'POST',
+ path: `/api/projects/${TEST_PROJECT_ID}/property_definitions/`,
+ body: { name: '$browser', type: 1, is_numerical: false },
+ })
+ }
+ })
+
it('should update property definition description', async () => {
const testDescription = `Test description ${uuidv4()}`
const result = await updateTool.handler(context, {