: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
fix(mcp): default user-get uuid to @me so no-arg calls validate (#91446)
posthog[bot]79b37bf41702
diff --git a/services/mcp/definitions/core.yaml b/services/mcp/definitions/core.yamlindex f4944a0d8658..327551ef76ee 100644--- a/services/mcp/definitions/core.yaml+++ b/services/mcp/definitions/core.yaml@@ -503,6 +503,7 @@ tools:param_overrides:uuid:description: User UUID, or `@me` to target the authenticated user.+ default: '@me'response:include:- iddiff --git a/services/mcp/src/tools/generated/core.ts b/services/mcp/src/tools/generated/core.tsindex cf75e632c51d..c5a8079ec4f4 100644--- a/services/mcp/src/tools/generated/core.ts+++ b/services/mcp/src/tools/generated/core.ts@@ -401,7 +401,10 @@ const projectSettingsUpdate = (): ToolBase<const UserGetSchema = () => {const UsersRetrieveParams = orvalSchemas.UsersRetrieveParams()return UsersRetrieveParams.extend({- uuid: UsersRetrieveParams.shape['uuid'].describe('User UUID, or `@me` to target the authenticated user.'),+ uuid: UsersRetrieveParams.shape['uuid']+ .default('@me')+ .optional()+ .describe('User UUID, or `@me` to target the authenticated user.'),})}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/user-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/user-get.jsonindex 81342348c1d3..e7ef2095048b 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/user-get.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/user-get.json@@ -2,10 +2,10 @@"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {"uuid": {+ "default": "@me","description": "User UUID, or `@me` to target the authenticated user.","type": "string"}},- "required": ["uuid"],"type": "object"}diff --git a/services/mcp/tests/unit/exec.test.ts b/services/mcp/tests/unit/exec.test.tsindex 2115cc8098a7..75bd62ca7505 100644--- a/services/mcp/tests/unit/exec.test.ts+++ b/services/mcp/tests/unit/exec.test.ts@@ -269,6 +269,39 @@ describe('exec tool', () => {})})+ describe('user-get uuid contract', () => {+ // `user-get` fetches the caller's own profile, so CLI clients routinely dispatch+ // `call user-get` with no body — the exec parser then hands the schema an empty+ // `{}`. The generated schema defaults `uuid` to `@me`, so that shape must validate+ // and reach the handler as `@me`. An explicit UUID must still pass through.+ const userGetFactory = GENERATED_TOOL_MAP['user-get']+ if (!userGetFactory) {+ throw new Error('user-get generated tool is missing')+ }+ const userGetSchema = userGetFactory().schema++ it.each([+ { name: 'empty body defaults uuid to @me', command: 'call user-get', expected: { uuid: '@me' } },+ {+ name: 'explicit uuid passes through unchanged',+ command: 'call user-get {"uuid":"00000000-0000-0000-0000-000000000abc"}',+ expected: { uuid: '00000000-0000-0000-0000-000000000abc' },+ },+ ])('$name', async ({ command, expected }) => {+ let received: Record<string, unknown> | undefined+ const userGet = makeMockTool({+ name: 'user-get',+ schema: userGetSchema,+ handler: async (_context, params) => {+ received = params as Record<string, unknown>+ return { ok: true }+ },+ })+ await createExec([userGet]).handler(mockContext, { command })+ expect(received).toEqual(expected)+ })+ })+describe('call command', () => {it('returns TOON-formatted output by default', async () => {const exec = createExec()