: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
feat(mcp): trim user-get to user-owned fields and id+name refs (#65310)
posthog[bot]24372eaa68da
diff --git a/services/mcp/definitions/core.yaml b/services/mcp/definitions/core.yamlindex 3a5ac5239929..36f75c8c3509 100644--- a/services/mcp/definitions/core.yaml+++ b/services/mcp/definitions/core.yaml@@ -600,17 +600,51 @@ tools:idempotent: truetitle: Get userdescription: >- Retrieve a user's profile and settings. Pass `@me` as the UUID to fetch the authenticated user — non-staff- callers may only access their own account.+ Retrieve the authenticated user's own profile and settings — identity (id, uuid, distinct_id, email, name),+ security/auth state, preferences, and notification settings. Pass `@me` as the UUID to fetch the+ authenticated user; non-staff callers may only access their own account. This tool deliberately does NOT+ return organization or project configuration: the nested `organization`, `team`, and `organizations` objects+ are trimmed to just `id` and `name` (no API tokens, members, available features, or project settings). Use+ `project-get` for full project details, and the organization-scoped tools for organization details.param_overrides:uuid:description: User UUID, or `@me` to target the authenticated user.response:- exclude:- - is_impersonated- - is_impersonated_until- - is_impersonated_read_only- - sensitive_session_expires_at+ include:+ - id+ - uuid+ - distinct_id+ - pending_email+ - is_email_verified+ - first_name+ - last_name+ - date_joined+ - is_staff+ - has_password+ - is_2fa_enabled+ - has_social_auth+ - has_sso_enforcement+ - passkeys_enabled_for_2fa+ - allow_impersonation+ - notification_settings+ - anonymize_data+ - toolbar_mode+ - events_column_config+ - theme_mode+ - hedgehog_config+ - allow_sidebar_suggestions+ - shortcut_position+ - role_at_organization+ - hide_mcp_hints+ - scene_personalisation+ - pending_invites+ - organization.id+ - organization.name+ - team.id+ - team.name+ - organizations.*.id+ - organizations.*.nameuser-settings-update:operation: users_partial_updateenabled: truediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 9a740233e041..0135be28096f 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -6851,7 +6851,7 @@}},"user-get": {- "description": "Retrieve a user's profile and settings. Pass `@me` as the UUID to fetch the authenticated user — non-staff callers may only access their own account.",+ "description": "Retrieve the authenticated user's own profile and settings — identity (id, uuid, distinct_id, email, name), security/auth state, preferences, and notification settings. Pass `@me` as the UUID to fetch the authenticated user; non-staff callers may only access their own account. This tool deliberately does NOT return organization or project configuration: the nested `organization`, `team`, and `organizations` objects are trimmed to just `id` and `name` (no API tokens, members, available features, or project settings). Use `project-get` for full project details, and the organization-scoped tools for organization details.","category": "Core","feature": "core","summary": "Get user",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 6c11045e99c1..012bd3e9a5d3 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -7374,7 +7374,7 @@}},"user-get": {- "description": "Retrieve a user's profile and settings. Pass `@me` as the UUID to fetch the authenticated user — non-staff callers may only access their own account.",+ "description": "Retrieve the authenticated user's own profile and settings — identity (id, uuid, distinct_id, email, name), security/auth state, preferences, and notification settings. Pass `@me` as the UUID to fetch the authenticated user; non-staff callers may only access their own account. This tool deliberately does NOT return organization or project configuration: the nested `organization`, `team`, and `organizations` objects are trimmed to just `id` and `name` (no API tokens, members, available features, or project settings). Use `project-get` for full project details, and the organization-scoped tools for organization details.","category": "Core","feature": "core","summary": "Get user",diff --git a/services/mcp/src/tools/generated/core.ts b/services/mcp/src/tools/generated/core.tsindex a980c27928d4..91a77f46d338 100644--- a/services/mcp/src/tools/generated/core.ts+++ b/services/mcp/src/tools/generated/core.ts@@ -19,7 +19,7 @@ import {UsersRetrieveParams,} from '@/generated/core/api'import { castStringToInt } from '@/tools/cast-helpers'-import { omitResponseFields } from '@/tools/tool-utils'+import { omitResponseFields, pickResponseFields } from '@/tools/tool-utils'import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'const DesktopFileSystemCanvasPartialUpdateSchema = DesktopFileSystemCanvasPartialUpdateParams.omit({ project_id: true })@@ -468,11 +468,41 @@ const userGet = (): ToolBase<typeof UserGetSchema, Schemas.User> => ({method: 'GET',path: `/api/users/${encodeURIComponent(String(params.uuid))}/`,})- const filtered = omitResponseFields(result, [- 'is_impersonated',- 'is_impersonated_until',- 'is_impersonated_read_only',- 'sensitive_session_expires_at',+ const filtered = pickResponseFields(result, [+ 'id',+ 'uuid',+ 'distinct_id',+ 'email',+ 'pending_email',+ 'is_email_verified',+ 'first_name',+ 'last_name',+ 'date_joined',+ 'is_staff',+ 'has_password',+ 'is_2fa_enabled',+ 'has_social_auth',+ 'has_sso_enforcement',+ 'passkeys_enabled_for_2fa',+ 'allow_impersonation',+ 'notification_settings',+ 'anonymize_data',+ 'toolbar_mode',+ 'events_column_config',+ 'theme_mode',+ 'hedgehog_config',+ 'allow_sidebar_suggestions',+ 'shortcut_position',+ 'role_at_organization',+ 'hide_mcp_hints',+ 'scene_personalisation',+ 'pending_invites',+ 'organization.id',+ 'organization.name',+ 'team.id',+ 'team.name',+ 'organizations.*.id',+ 'organizations.*.name',]) as typeof resultreturn filtered},