From 31b152d319235d58c9b38c65553b3f2d407b578d Mon Sep 17 00:00:00 2001 From: Danny Roosevelt Date: Wed, 15 Oct 2025 16:09:35 -0700 Subject: [PATCH 1/6] Get Current User actions Starting with a handful of the top apps --- .../get-current-user/get-current-user.mjs | 41 +++++ components/github/package.json | 2 +- .../get-current-user/get-current-user.mjs | 58 +++++++ components/google_calendar/package.json | 2 +- .../get-current-user/get-current-user.mjs | 32 ++++ components/google_drive/package.json | 2 +- .../get-current-user/get-current-user.mjs | 32 ++++ components/google_sheets/package.json | 2 +- .../get-current-user/get-current-user.mjs | 160 ++++++++++++++++++ components/linear/package.json | 2 +- .../get-current-user/get-current-user.mjs | 42 +++++ components/notion/package.json | 2 +- .../get-current-user/get-current-user.mjs | 101 +++++++++++ components/slack/package.json | 2 +- 14 files changed, 473 insertions(+), 7 deletions(-) create mode 100644 components/github/actions/get-current-user/get-current-user.mjs create mode 100644 components/google_calendar/actions/get-current-user/get-current-user.mjs create mode 100644 components/google_drive/actions/get-current-user/get-current-user.mjs create mode 100644 components/google_sheets/actions/get-current-user/get-current-user.mjs create mode 100644 components/linear/actions/get-current-user/get-current-user.mjs create mode 100644 components/notion/actions/get-current-user/get-current-user.mjs create mode 100644 components/slack/actions/get-current-user/get-current-user.mjs diff --git a/components/github/actions/get-current-user/get-current-user.mjs b/components/github/actions/get-current-user/get-current-user.mjs new file mode 100644 index 0000000000000..ba7e765116f7a --- /dev/null +++ b/components/github/actions/get-current-user/get-current-user.mjs @@ -0,0 +1,41 @@ +import github from "../../github.app.mjs"; + +const DEFAULT_ORGS_LIMIT = 20; +const DEFAULT_TEAMS_LIMIT = 20; + +export default { + key: "github-get-current-user", + name: "Get Current User", + description: "Gather a full snapshot of the authenticated GitHub actor, combining `/user`, `/user/orgs`, and `/user/teams`. Returns profile metadata (login, name, email, company, plan, creation timestamps) and trimmed lists of organizations and teams for quick role awareness. Helpful when you need to validate which user is calling the API, adapt behavior based on their org/team memberships, or provide LLMs with grounding before repository operations. Uses OAuth authentication. [See the documentation](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user).", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + github, + }, + async run({ $ }) { + const [ + user, + organizations, + teams, + ] = await Promise.all([ + this.github.getAuthenticatedUser(), + this.github.getOrganizations() + .then((orgs) => orgs.slice(0, DEFAULT_ORGS_LIMIT)), + this.github.getTeams() + .then((teamsResponse) => teamsResponse.slice(0, DEFAULT_TEAMS_LIMIT)), + ]); + + $.export("$summary", `Retrieved GitHub user ${user.login}`); + + return { + user, + organizations, + teams, + }; + }, +}; diff --git a/components/github/package.json b/components/github/package.json index 642a39949afe8..9d838b35d9cd5 100644 --- a/components/github/package.json +++ b/components/github/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/github", - "version": "1.8.0", + "version": "1.8.1", "description": "Pipedream Github Components", "main": "github.app.mjs", "keywords": [ diff --git a/components/google_calendar/actions/get-current-user/get-current-user.mjs b/components/google_calendar/actions/get-current-user/get-current-user.mjs new file mode 100644 index 0000000000000..9e259a56e3b90 --- /dev/null +++ b/components/google_calendar/actions/get-current-user/get-current-user.mjs @@ -0,0 +1,58 @@ +import googleCalendar from "../../google_calendar.app.mjs"; +import constants from "../../common/constants.mjs"; + +const DEFAULT_CALENDAR_SAMPLE_LIMIT = 25; + +export default { + key: "google_calendar-get-current-user", + name: "Get Current User", + description: "Retrieve information about the authenticated Google Calendar account, including the primary calendar (summary, timezone, ACL flags), a list of accessible calendars, user-level settings (timezone, locale, week start), and the color palette that controls events and calendars. Ideal for confirming which calendar account is in use, customizing downstream scheduling, or equipping LLMs with the user’s context (timezones, available calendars) prior to creating or updating events. Uses OAuth authentication. [See the documentation](https://developers.google.com/calendar/api/v3/reference/calendars/get).", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + googleCalendar, + }, + async run({ $ }) { + const [ + primaryCalendar, + calendarList, + settings, + colors, + ] = await Promise.all([ + this.googleCalendar.getCalendar({ + calendarId: "primary", + }), + this.googleCalendar.listCalendars({ + maxResults: DEFAULT_CALENDAR_SAMPLE_LIMIT, + }), + this.googleCalendar.requestHandler({ + api: constants.API.SETTINGS.NAME, + method: constants.API.SETTINGS.METHOD.LIST, + }), + this.googleCalendar.requestHandler({ + api: constants.API.COLORS.NAME, + method: constants.API.COLORS.METHOD.GET, + }), + ]); + + const timezoneSetting = settings?.items?.find?.((setting) => setting.id === "timezone")?.value; + const localeSetting = settings?.items?.find?.((setting) => setting.id === "locale")?.value; + + const summaryName = primaryCalendar?.summary || primaryCalendar?.id; + $.export("$summary", `Retrieved Google Calendar user ${summaryName}`); + + return { + primaryCalendar, + calendars: calendarList?.items ?? [], + settings: settings?.items ?? [], + timezone: timezoneSetting || primaryCalendar?.timeZone, + locale: localeSetting, + colors, + }; + }, +}; diff --git a/components/google_calendar/package.json b/components/google_calendar/package.json index e1f35ff659558..e8520f19d1e96 100644 --- a/components/google_calendar/package.json +++ b/components/google_calendar/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_calendar", - "version": "0.5.12", + "version": "0.5.13", "description": "Pipedream Google_calendar Components", "main": "google_calendar.app.mjs", "keywords": [ diff --git a/components/google_drive/actions/get-current-user/get-current-user.mjs b/components/google_drive/actions/get-current-user/get-current-user.mjs new file mode 100644 index 0000000000000..6aac0dc17740a --- /dev/null +++ b/components/google_drive/actions/get-current-user/get-current-user.mjs @@ -0,0 +1,32 @@ +import googleDrive from "../../google_drive.app.mjs"; + +const ABOUT_FIELDS = "user,storageQuota"; + +export default { + key: "google_drive-get-current-user", + name: "Get Current User", + description: "Retrieve Google Drive account metadata for the authenticated user via `about.get`, including display name, email, permission ID, and storage quota. Useful when flows or agents need to confirm the active Google identity or understand available storage. Uses OAuth authentication. [See the documentation](https://developers.google.com/drive/api/v3/reference/about/get).", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + googleDrive, + }, + async run({ $ }) { + const about = await this.googleDrive.getAbout(ABOUT_FIELDS); + + const summaryName = + about?.user?.displayName + || about?.user?.emailAddress + || about?.user?.permissionId; + $.export("$summary", `Retrieved Google Drive user ${summaryName}`); + + return { + about, + }; + }, +}; diff --git a/components/google_drive/package.json b/components/google_drive/package.json index a84d94d5e6297..56a2cd73e6d7b 100644 --- a/components/google_drive/package.json +++ b/components/google_drive/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_drive", - "version": "1.1.1", + "version": "1.1.2", "description": "Pipedream Google_drive Components", "main": "google_drive.app.mjs", "keywords": [ diff --git a/components/google_sheets/actions/get-current-user/get-current-user.mjs b/components/google_sheets/actions/get-current-user/get-current-user.mjs new file mode 100644 index 0000000000000..5d866228a54fe --- /dev/null +++ b/components/google_sheets/actions/get-current-user/get-current-user.mjs @@ -0,0 +1,32 @@ +import googleSheets from "../../google_sheets.app.mjs"; + +const ABOUT_FIELDS = "user,storageQuota"; + +export default { + key: "google_sheets-get-current-user", + name: "Get Current User", + description: "Retrieve Google Sheets account metadata for the authenticated user by calling Drive's `about.get`, returning the user profile (display name, email, permission ID) and storage quota information. Helpful when you need to verify which Google account is active, tailor sheet operations to available storage, or give an LLM clear context about the user identity before composing read/write actions. Uses OAuth authentication. [See the Drive API documentation](https://developers.google.com/drive/api/v3/reference/about/get).", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + googleSheets, + }, + async run({ $ }) { + const about = await this.googleSheets.getAbout(ABOUT_FIELDS); + + const summaryName = + about?.user?.displayName + || about?.user?.emailAddress + || about?.user?.permissionId; + $.export("$summary", `Retrieved Google Sheets user ${summaryName}`); + + return { + about, + }; + }, +}; diff --git a/components/google_sheets/package.json b/components/google_sheets/package.json index c9352fe50c4d4..f032aa5104a63 100644 --- a/components/google_sheets/package.json +++ b/components/google_sheets/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_sheets", - "version": "0.9.1", + "version": "0.9.2", "description": "Pipedream Google_sheets Components", "main": "google_sheets.app.mjs", "keywords": [ diff --git a/components/linear/actions/get-current-user/get-current-user.mjs b/components/linear/actions/get-current-user/get-current-user.mjs new file mode 100644 index 0000000000000..93b541b079a24 --- /dev/null +++ b/components/linear/actions/get-current-user/get-current-user.mjs @@ -0,0 +1,160 @@ +import linearApp from "../../linear.app.mjs"; + +const DEFAULT_CONNECTION_LIMIT = 50; + +const toIsoString = (value) => value?.toISOString?.() ?? null; +const toPageInfo = (pageInfo) => pageInfo && ({ + endCursor: pageInfo.endCursor, + hasNextPage: pageInfo.hasNextPage, + hasPreviousPage: pageInfo.hasPreviousPage, + startCursor: pageInfo.startCursor, +}); + +export default { + key: "linear-get-current-user", + name: "Get Current User", + description: "Retrieve rich context about the authenticated Linear user, including core profile fields, recent timestamps, direct team memberships, and high-level organization settings. Returns the user object, a paginated team list (with names, keys, cycle configs, etc.), associated team memberships, and organization metadata such as auth defaults and SCIM/SAML flags. Use this when your workflow or agent needs to understand who is currently authenticated, which teams they belong to, or what workspace policies might influence subsequent Linear actions. Uses OAuth authentication. See Linear's GraphQL viewer docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api).", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + linearApp, + }, + async run({ $ }) { + const client = this.linearApp.client(); + const viewer = await client.viewer; + + const [ + organization, + teamsConnection, + teamMembershipsConnection, + ] = await Promise.all([ + viewer.organization, + viewer.teams({ + first: DEFAULT_CONNECTION_LIMIT, + }), + viewer.teamMemberships({ + first: DEFAULT_CONNECTION_LIMIT, + }), + ]); + + const teams = teamsConnection?.nodes?.map((team) => ({ + id: team.id, + key: team.key, + name: team.name, + displayName: team.displayName, + description: team.description, + icon: team.icon, + color: team.color, + private: team.private, + timezone: team.timezone, + inviteHash: team.inviteHash, + issueCount: team.issueCount, + cycleDuration: team.cycleDuration, + cyclesEnabled: team.cyclesEnabled, + triageEnabled: team.triageEnabled, + createdAt: toIsoString(team.createdAt), + updatedAt: toIsoString(team.updatedAt), + })) ?? []; + + const user = { + id: viewer.id, + name: viewer.name, + displayName: viewer.displayName, + email: viewer.email, + active: viewer.active, + admin: viewer.admin, + guest: viewer.guest, + description: viewer.description, + disableReason: viewer.disableReason, + timezone: viewer.timezone, + statusEmoji: viewer.statusEmoji, + statusLabel: viewer.statusLabel, + isAssignable: viewer.isAssignable, + isMentionable: viewer.isMentionable, + avatarUrl: viewer.avatarUrl, + url: viewer.url, + calendarHash: viewer.calendarHash, + inviteHash: viewer.inviteHash, + initials: viewer.initials, + createdIssueCount: viewer.createdIssueCount, + createdAt: toIsoString(viewer.createdAt), + updatedAt: toIsoString(viewer.updatedAt), + archivedAt: toIsoString(viewer.archivedAt), + lastSeen: toIsoString(viewer.lastSeen), + statusUntilAt: toIsoString(viewer.statusUntilAt), + }; + + const teamMemberships = teamMembershipsConnection?.nodes?.map((membership) => ({ + id: membership.id, + owner: membership.owner, + sortOrder: membership.sortOrder, + teamId: membership.teamId, + userId: membership.userId, + createdAt: toIsoString(membership.createdAt), + updatedAt: toIsoString(membership.updatedAt), + archivedAt: toIsoString(membership.archivedAt), + })) ?? []; + + const organizationData = organization && { + id: organization.id, + name: organization.name, + urlKey: organization.urlKey, + allowedAuthServices: organization.allowedAuthServices, + allowMembersToInvite: organization.allowMembersToInvite, + customersEnabled: organization.customersEnabled, + feedEnabled: organization.feedEnabled, + gitBranchFormat: organization.gitBranchFormat, + gitLinkbackMessagesEnabled: organization.gitLinkbackMessagesEnabled, + gitPublicLinkbackMessagesEnabled: organization.gitPublicLinkbackMessagesEnabled, + initiativeUpdateReminderFrequencyInWeeks: + organization.initiativeUpdateReminderFrequencyInWeeks, + initiativeUpdateRemindersDay: organization.initiativeUpdateRemindersDay, + initiativeUpdateRemindersHour: organization.initiativeUpdateRemindersHour, + projectUpdateReminderFrequencyInWeeks: + organization.projectUpdateReminderFrequencyInWeeks, + projectUpdateRemindersDay: organization.projectUpdateRemindersDay, + projectUpdateRemindersHour: organization.projectUpdateRemindersHour, + projectUpdatesReminderFrequency: organization.projectUpdatesReminderFrequency, + restrictLabelManagementToAdmins: organization.restrictLabelManagementToAdmins, + restrictTeamCreationToAdmins: organization.restrictTeamCreationToAdmins, + roadmapEnabled: organization.roadmapEnabled, + samlEnabled: organization.samlEnabled, + scimEnabled: organization.scimEnabled, + releaseChannel: organization.releaseChannel, + fiscalYearStartMonth: organization.fiscalYearStartMonth, + slaDayCount: organization.slaDayCount, + previousUrlKeys: organization.previousUrlKeys, + logoUrl: organization.logoUrl, + createdIssueCount: organization.createdIssueCount, + customerCount: organization.customerCount, + periodUploadVolume: organization.periodUploadVolume, + userCount: organization.userCount, + trialEndsAt: toIsoString(organization.trialEndsAt), + deletionRequestedAt: toIsoString(organization.deletionRequestedAt), + archivedAt: toIsoString(organization.archivedAt), + createdAt: toIsoString(organization.createdAt), + updatedAt: toIsoString(organization.updatedAt), + }; + + const summaryIdentifier = user.name || user.displayName || user.email || user.id; + $.export("$summary", `Retrieved Linear user ${summaryIdentifier}`); + + return { + user, + organization: organizationData, + teams: { + nodes: teams, + pageInfo: toPageInfo(teamsConnection?.pageInfo), + }, + teamMemberships: { + nodes: teamMemberships, + pageInfo: toPageInfo(teamMembershipsConnection?.pageInfo), + }, + }; + }, +}; diff --git a/components/linear/package.json b/components/linear/package.json index 0d1cfe50101c6..af04129de2b77 100644 --- a/components/linear/package.json +++ b/components/linear/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/linear", - "version": "0.8.0", + "version": "0.8.1", "description": "Pipedream Linear Components", "main": "linear.app.mjs", "keywords": [ diff --git a/components/notion/actions/get-current-user/get-current-user.mjs b/components/notion/actions/get-current-user/get-current-user.mjs new file mode 100644 index 0000000000000..4cf3b909ddad3 --- /dev/null +++ b/components/notion/actions/get-current-user/get-current-user.mjs @@ -0,0 +1,42 @@ +import notion from "../../notion.app.mjs"; + +export default { + key: "notion-get-current-user", + name: "Get Current User", + description: "Retrieve the Notion identity tied to the current OAuth token, returning the full `users.retrieve` payload for `me` (person or bot). Includes the user ID, name, avatar URL, type (`person` vs `bot`), and workspace ownership metadata—useful for confirming which workspace is connected, adapting downstream queries, or giving an LLM the context it needs about who is operating inside Notion. Uses OAuth authentication. [See the documentation](https://developers.notion.com/reference/get-user).", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + notion, + }, + async run({ $ }) { + const response = await this.notion.getUser("me"); + + const displayName = response?.name || response?.bot?.workspace_name || response?.id; + const ownerUser = response?.bot?.owner?.user; + const ownerName = ownerUser?.name || ownerUser?.id; + const ownerEmail = ownerUser?.person?.email; + const summaryParts = [ + response?.bot?.workspace_name && `workspace **${response.bot.workspace_name}**`, + (() => { + if (!ownerName && !ownerEmail) return null; + if (ownerName && ownerEmail) return `owner ${ownerName} (<${ownerEmail}>)`; + if (ownerName) return `owner ${ownerName}`; + return `owner <${ownerEmail}>`; + })(), + ].filter(Boolean); + + const summaryContext = summaryParts.length + ? ` — ${summaryParts.join(", ")}` + : ""; + + $.export("$summary", `Retrieved Notion ${response?.type || "user"} **${displayName}**${summaryContext}`); + + return response; + }, +}; diff --git a/components/notion/package.json b/components/notion/package.json index 94ec509ff7bbd..9898f4a4f92b6 100644 --- a/components/notion/package.json +++ b/components/notion/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/notion", - "version": "1.0.3", + "version": "1.0.4", "description": "Pipedream Notion Components", "main": "notion.app.mjs", "keywords": [ diff --git a/components/slack/actions/get-current-user/get-current-user.mjs b/components/slack/actions/get-current-user/get-current-user.mjs new file mode 100644 index 0000000000000..e13dc9750baa8 --- /dev/null +++ b/components/slack/actions/get-current-user/get-current-user.mjs @@ -0,0 +1,101 @@ +import slack from "../../slack.app.mjs"; + +export default { + key: "slack-get-current-user", + name: "Get Current User", + description: "Retrieve comprehensive context about the authenticated Slack member, combining `auth.test`, `users.info`, `users.profile.get`, and `team.info` payloads. Returns the user’s profile (name variants, email, locale, timezone, status, admin flags), raw auth test data, and workspace metadata (domain, enterprise info, icons). Ideal when you need to confirm which user token is active, tailor messages to their locale/timezone, or ground an LLM in the member’s role and workspace before executing other Slack actions. Uses OAuth authentication. [See Slack API docs](https://api.slack.com/methods/auth.test).", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + slack, + }, + async run({ $ }) { + const authContext = await this.slack.authTest({ + throwRateLimitError: true, + }); + + const userId = authContext.user_id || authContext.user; + + let userInfo; + try { + userInfo = await this.slack.usersInfo({ + user: userId, + include_locale: true, + throwRateLimitError: true, + }); + } catch (error) { + // Gracefully degrade if scope not available + } + + let userProfile; + try { + userProfile = await this.slack.getUserProfile({ + user: userId, + throwRateLimitError: true, + }); + } catch (error) { + // Gracefully degrade if scope not available + } + + let teamInfo; + try { + teamInfo = await this.slack.getTeamInfo({ + throwRateLimitError: true, + }); + } catch (error) { + // Gracefully degrade if scope not available + } + + const user = userInfo?.user; + const profile = userProfile?.profile ?? user?.profile; + const summaryName = + profile?.real_name_normalized + || profile?.display_name_normalized + || authContext.user + || userId; + + $.export( + "$summary", + `Retrieved Slack user ${summaryName}`, + ); + + return { + authContext, + user: user && { + id: user.id, + teamId: user.team_id, + name: profile?.real_name_normalized || user.real_name, + displayName: profile?.display_name_normalized || user.name, + email: profile?.email, + locale: user.locale, + timezone: user.tz, + timezoneLabel: user.tz_label, + timezoneOffset: user.tz_offset, + isAdmin: user.is_admin, + isOwner: user.is_owner, + isPrimaryOwner: user.is_primary_owner, + isRestricted: user.is_restricted, + isUltraRestricted: user.is_ultra_restricted, + isBot: user.is_bot, + isAppUser: user.is_app_user, + updated: user.updated, + color: user.color, + profile, + }, + team: teamInfo?.team && { + id: teamInfo.team.id, + name: teamInfo.team.name, + domain: teamInfo.team.domain, + emailDomain: teamInfo.team.email_domain, + icon: teamInfo.team.icon, + enterpriseId: teamInfo.team.enterprise_id, + enterpriseName: teamInfo.team.enterprise_name, + }, + }; + }, +}; diff --git a/components/slack/package.json b/components/slack/package.json index 1c5aae17dca63..46ffd0bffc500 100644 --- a/components/slack/package.json +++ b/components/slack/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/slack", - "version": "0.10.2", + "version": "0.10.3", "description": "Pipedream Slack Components", "main": "slack.app.mjs", "keywords": [ From 26d407046ff3cc2ccbd44fa91838f8d92210b6f5 Mon Sep 17 00:00:00 2001 From: Danny Roosevelt Date: Wed, 15 Oct 2025 16:20:14 -0700 Subject: [PATCH 2/6] Update get-current-user.mjs --- .../actions/get-current-user/get-current-user.mjs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/components/slack/actions/get-current-user/get-current-user.mjs b/components/slack/actions/get-current-user/get-current-user.mjs index e13dc9750baa8..bb9f4f7494af1 100644 --- a/components/slack/actions/get-current-user/get-current-user.mjs +++ b/components/slack/actions/get-current-user/get-current-user.mjs @@ -15,9 +15,7 @@ export default { slack, }, async run({ $ }) { - const authContext = await this.slack.authTest({ - throwRateLimitError: true, - }); + const authContext = await this.slack.authTest(); const userId = authContext.user_id || authContext.user; @@ -26,7 +24,6 @@ export default { userInfo = await this.slack.usersInfo({ user: userId, include_locale: true, - throwRateLimitError: true, }); } catch (error) { // Gracefully degrade if scope not available @@ -36,7 +33,6 @@ export default { try { userProfile = await this.slack.getUserProfile({ user: userId, - throwRateLimitError: true, }); } catch (error) { // Gracefully degrade if scope not available @@ -44,9 +40,7 @@ export default { let teamInfo; try { - teamInfo = await this.slack.getTeamInfo({ - throwRateLimitError: true, - }); + teamInfo = await this.slack.getTeamInfo(); } catch (error) { // Gracefully degrade if scope not available } From ed7e235a69ad2a61eb62c6e95529a77d03c62194 Mon Sep 17 00:00:00 2001 From: Danny Roosevelt Date: Wed, 15 Oct 2025 16:20:21 -0700 Subject: [PATCH 3/6] Merge branch 'danny/authed-user-actions' of github.com:PipedreamHQ/pipedream into danny/authed-user-actions From 9beca8ebb12768b6d2bc3af56753f0f8bd6773a7 Mon Sep 17 00:00:00 2001 From: Danny Roosevelt Date: Wed, 15 Oct 2025 16:25:22 -0700 Subject: [PATCH 4/6] Update get-current-user.mjs --- components/slack/actions/get-current-user/get-current-user.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/slack/actions/get-current-user/get-current-user.mjs b/components/slack/actions/get-current-user/get-current-user.mjs index bb9f4f7494af1..e72fc591bcee4 100644 --- a/components/slack/actions/get-current-user/get-current-user.mjs +++ b/components/slack/actions/get-current-user/get-current-user.mjs @@ -18,6 +18,9 @@ export default { const authContext = await this.slack.authTest(); const userId = authContext.user_id || authContext.user; + if (!userId) { + throw new Error(`Unable to determine user ID from auth context. Received: ${JSON.stringify(authContext)}`); + } let userInfo; try { From b4224b6e464fcc602c4aaeaafd79967c6e8ad69c Mon Sep 17 00:00:00 2001 From: Danny Roosevelt Date: Wed, 15 Oct 2025 16:35:07 -0700 Subject: [PATCH 5/6] Cleaning up the descriptions --- components/github/actions/get-current-user/get-current-user.mjs | 2 +- .../actions/get-current-user/get-current-user.mjs | 2 +- .../google_drive/actions/get-current-user/get-current-user.mjs | 2 +- .../google_sheets/actions/get-current-user/get-current-user.mjs | 2 +- components/linear/actions/get-current-user/get-current-user.mjs | 2 +- components/notion/actions/get-current-user/get-current-user.mjs | 2 +- components/slack/actions/get-current-user/get-current-user.mjs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/github/actions/get-current-user/get-current-user.mjs b/components/github/actions/get-current-user/get-current-user.mjs index ba7e765116f7a..45db1592a81fb 100644 --- a/components/github/actions/get-current-user/get-current-user.mjs +++ b/components/github/actions/get-current-user/get-current-user.mjs @@ -6,7 +6,7 @@ const DEFAULT_TEAMS_LIMIT = 20; export default { key: "github-get-current-user", name: "Get Current User", - description: "Gather a full snapshot of the authenticated GitHub actor, combining `/user`, `/user/orgs`, and `/user/teams`. Returns profile metadata (login, name, email, company, plan, creation timestamps) and trimmed lists of organizations and teams for quick role awareness. Helpful when you need to validate which user is calling the API, adapt behavior based on their org/team memberships, or provide LLMs with grounding before repository operations. Uses OAuth authentication. [See the documentation](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user).", + description: "Gather a full snapshot of the authenticated GitHub actor, combining `/user`, `/user/orgs`, and `/user/teams`. Returns profile metadata (login, name, email, company, plan, creation timestamps) and trimmed lists of organizations and teams for quick role awareness. Helpful when you need to validate which user is calling the API, adapt behavior based on their org/team memberships, or provide LLMs with grounding before repository operations. [See the documentation](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user).", version: "0.0.1", type: "action", annotations: { diff --git a/components/google_calendar/actions/get-current-user/get-current-user.mjs b/components/google_calendar/actions/get-current-user/get-current-user.mjs index 9e259a56e3b90..110b0a58b8123 100644 --- a/components/google_calendar/actions/get-current-user/get-current-user.mjs +++ b/components/google_calendar/actions/get-current-user/get-current-user.mjs @@ -6,7 +6,7 @@ const DEFAULT_CALENDAR_SAMPLE_LIMIT = 25; export default { key: "google_calendar-get-current-user", name: "Get Current User", - description: "Retrieve information about the authenticated Google Calendar account, including the primary calendar (summary, timezone, ACL flags), a list of accessible calendars, user-level settings (timezone, locale, week start), and the color palette that controls events and calendars. Ideal for confirming which calendar account is in use, customizing downstream scheduling, or equipping LLMs with the user’s context (timezones, available calendars) prior to creating or updating events. Uses OAuth authentication. [See the documentation](https://developers.google.com/calendar/api/v3/reference/calendars/get).", + description: "Retrieve information about the authenticated Google Calendar account, including the primary calendar (summary, timezone, ACL flags), a list of accessible calendars, user-level settings (timezone, locale, week start), and the color palette that controls events and calendars. Ideal for confirming which calendar account is in use, customizing downstream scheduling, or equipping LLMs with the user’s context (timezones, available calendars) prior to creating or updating events. [See the documentation](https://developers.google.com/calendar/api/v3/reference/calendars/get).", version: "0.0.1", type: "action", annotations: { diff --git a/components/google_drive/actions/get-current-user/get-current-user.mjs b/components/google_drive/actions/get-current-user/get-current-user.mjs index 6aac0dc17740a..66bb534c355e1 100644 --- a/components/google_drive/actions/get-current-user/get-current-user.mjs +++ b/components/google_drive/actions/get-current-user/get-current-user.mjs @@ -5,7 +5,7 @@ const ABOUT_FIELDS = "user,storageQuota"; export default { key: "google_drive-get-current-user", name: "Get Current User", - description: "Retrieve Google Drive account metadata for the authenticated user via `about.get`, including display name, email, permission ID, and storage quota. Useful when flows or agents need to confirm the active Google identity or understand available storage. Uses OAuth authentication. [See the documentation](https://developers.google.com/drive/api/v3/reference/about/get).", + description: "Retrieve Google Drive account metadata for the authenticated user via `about.get`, including display name, email, permission ID, and storage quota. Useful when flows or agents need to confirm the active Google identity or understand available storage. [See the documentation](https://developers.google.com/drive/api/v3/reference/about/get).", version: "0.0.1", type: "action", annotations: { diff --git a/components/google_sheets/actions/get-current-user/get-current-user.mjs b/components/google_sheets/actions/get-current-user/get-current-user.mjs index 5d866228a54fe..c9709a98f80ee 100644 --- a/components/google_sheets/actions/get-current-user/get-current-user.mjs +++ b/components/google_sheets/actions/get-current-user/get-current-user.mjs @@ -5,7 +5,7 @@ const ABOUT_FIELDS = "user,storageQuota"; export default { key: "google_sheets-get-current-user", name: "Get Current User", - description: "Retrieve Google Sheets account metadata for the authenticated user by calling Drive's `about.get`, returning the user profile (display name, email, permission ID) and storage quota information. Helpful when you need to verify which Google account is active, tailor sheet operations to available storage, or give an LLM clear context about the user identity before composing read/write actions. Uses OAuth authentication. [See the Drive API documentation](https://developers.google.com/drive/api/v3/reference/about/get).", + description: "Retrieve Google Sheets account metadata for the authenticated user by calling Drive's `about.get`, returning the user profile (display name, email, permission ID) and storage quota information. Helpful when you need to verify which Google account is active, tailor sheet operations to available storage, or give an LLM clear context about the user identity before composing read/write actions. [See the Drive API documentation](https://developers.google.com/drive/api/v3/reference/about/get).", version: "0.0.1", type: "action", annotations: { diff --git a/components/linear/actions/get-current-user/get-current-user.mjs b/components/linear/actions/get-current-user/get-current-user.mjs index 93b541b079a24..9a265d7657837 100644 --- a/components/linear/actions/get-current-user/get-current-user.mjs +++ b/components/linear/actions/get-current-user/get-current-user.mjs @@ -13,7 +13,7 @@ const toPageInfo = (pageInfo) => pageInfo && ({ export default { key: "linear-get-current-user", name: "Get Current User", - description: "Retrieve rich context about the authenticated Linear user, including core profile fields, recent timestamps, direct team memberships, and high-level organization settings. Returns the user object, a paginated team list (with names, keys, cycle configs, etc.), associated team memberships, and organization metadata such as auth defaults and SCIM/SAML flags. Use this when your workflow or agent needs to understand who is currently authenticated, which teams they belong to, or what workspace policies might influence subsequent Linear actions. Uses OAuth authentication. See Linear's GraphQL viewer docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api).", + description: "Retrieve rich context about the authenticated Linear user, including core profile fields, recent timestamps, direct team memberships, and high-level organization settings. Returns the user object, a paginated team list (with names, keys, cycle configs, etc.), associated team memberships, and organization metadata such as auth defaults and SCIM/SAML flags. Use this when your workflow or agent needs to understand who is currently authenticated, which teams they belong to, or what workspace policies might influence subsequent Linear actions. See Linear's GraphQL viewer docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api).", version: "0.0.1", type: "action", annotations: { diff --git a/components/notion/actions/get-current-user/get-current-user.mjs b/components/notion/actions/get-current-user/get-current-user.mjs index 4cf3b909ddad3..f0d13ca6259b8 100644 --- a/components/notion/actions/get-current-user/get-current-user.mjs +++ b/components/notion/actions/get-current-user/get-current-user.mjs @@ -3,7 +3,7 @@ import notion from "../../notion.app.mjs"; export default { key: "notion-get-current-user", name: "Get Current User", - description: "Retrieve the Notion identity tied to the current OAuth token, returning the full `users.retrieve` payload for `me` (person or bot). Includes the user ID, name, avatar URL, type (`person` vs `bot`), and workspace ownership metadata—useful for confirming which workspace is connected, adapting downstream queries, or giving an LLM the context it needs about who is operating inside Notion. Uses OAuth authentication. [See the documentation](https://developers.notion.com/reference/get-user).", + description: "Retrieve the Notion identity tied to the current OAuth token, returning the full `users.retrieve` payload for `me` (person or bot). Includes the user ID, name, avatar URL, type (`person` vs `bot`), and workspace ownership metadata—useful for confirming which workspace is connected, adapting downstream queries, or giving an LLM the context it needs about who is operating inside Notion. [See the documentation](https://developers.notion.com/reference/get-user).", version: "0.0.1", type: "action", annotations: { diff --git a/components/slack/actions/get-current-user/get-current-user.mjs b/components/slack/actions/get-current-user/get-current-user.mjs index e72fc591bcee4..1ec7cd49a89db 100644 --- a/components/slack/actions/get-current-user/get-current-user.mjs +++ b/components/slack/actions/get-current-user/get-current-user.mjs @@ -3,7 +3,7 @@ import slack from "../../slack.app.mjs"; export default { key: "slack-get-current-user", name: "Get Current User", - description: "Retrieve comprehensive context about the authenticated Slack member, combining `auth.test`, `users.info`, `users.profile.get`, and `team.info` payloads. Returns the user’s profile (name variants, email, locale, timezone, status, admin flags), raw auth test data, and workspace metadata (domain, enterprise info, icons). Ideal when you need to confirm which user token is active, tailor messages to their locale/timezone, or ground an LLM in the member’s role and workspace before executing other Slack actions. Uses OAuth authentication. [See Slack API docs](https://api.slack.com/methods/auth.test).", + description: "Retrieve comprehensive context about the authenticated Slack member, combining `auth.test`, `users.info`, `users.profile.get`, and `team.info` payloads. Returns the user’s profile (name variants, email, locale, timezone, status, admin flags), raw auth test data, and workspace metadata (domain, enterprise info, icons). Ideal when you need to confirm which user token is active, tailor messages to their locale/timezone, or ground an LLM in the member’s role and workspace before executing other Slack actions. [See Slack API docs](https://api.slack.com/methods/auth.test).", version: "0.0.1", type: "action", annotations: { From ed3f47da7403237e23342fde4d6c3493837a4a4d Mon Sep 17 00:00:00 2001 From: Danny Roosevelt Date: Wed, 15 Oct 2025 16:46:05 -0700 Subject: [PATCH 6/6] Cleaning up the code --- .../get-current-user/get-current-user.mjs | 123 +----------------- .../get-current-user/get-current-user.mjs | 38 +----- 2 files changed, 9 insertions(+), 152 deletions(-) diff --git a/components/linear/actions/get-current-user/get-current-user.mjs b/components/linear/actions/get-current-user/get-current-user.mjs index 9a265d7657837..7e58a7c91e60c 100644 --- a/components/linear/actions/get-current-user/get-current-user.mjs +++ b/components/linear/actions/get-current-user/get-current-user.mjs @@ -2,14 +2,6 @@ import linearApp from "../../linear.app.mjs"; const DEFAULT_CONNECTION_LIMIT = 50; -const toIsoString = (value) => value?.toISOString?.() ?? null; -const toPageInfo = (pageInfo) => pageInfo && ({ - endCursor: pageInfo.endCursor, - hasNextPage: pageInfo.hasNextPage, - hasPreviousPage: pageInfo.hasPreviousPage, - startCursor: pageInfo.startCursor, -}); - export default { key: "linear-get-current-user", name: "Get Current User", @@ -42,119 +34,14 @@ export default { }), ]); - const teams = teamsConnection?.nodes?.map((team) => ({ - id: team.id, - key: team.key, - name: team.name, - displayName: team.displayName, - description: team.description, - icon: team.icon, - color: team.color, - private: team.private, - timezone: team.timezone, - inviteHash: team.inviteHash, - issueCount: team.issueCount, - cycleDuration: team.cycleDuration, - cyclesEnabled: team.cyclesEnabled, - triageEnabled: team.triageEnabled, - createdAt: toIsoString(team.createdAt), - updatedAt: toIsoString(team.updatedAt), - })) ?? []; - - const user = { - id: viewer.id, - name: viewer.name, - displayName: viewer.displayName, - email: viewer.email, - active: viewer.active, - admin: viewer.admin, - guest: viewer.guest, - description: viewer.description, - disableReason: viewer.disableReason, - timezone: viewer.timezone, - statusEmoji: viewer.statusEmoji, - statusLabel: viewer.statusLabel, - isAssignable: viewer.isAssignable, - isMentionable: viewer.isMentionable, - avatarUrl: viewer.avatarUrl, - url: viewer.url, - calendarHash: viewer.calendarHash, - inviteHash: viewer.inviteHash, - initials: viewer.initials, - createdIssueCount: viewer.createdIssueCount, - createdAt: toIsoString(viewer.createdAt), - updatedAt: toIsoString(viewer.updatedAt), - archivedAt: toIsoString(viewer.archivedAt), - lastSeen: toIsoString(viewer.lastSeen), - statusUntilAt: toIsoString(viewer.statusUntilAt), - }; - - const teamMemberships = teamMembershipsConnection?.nodes?.map((membership) => ({ - id: membership.id, - owner: membership.owner, - sortOrder: membership.sortOrder, - teamId: membership.teamId, - userId: membership.userId, - createdAt: toIsoString(membership.createdAt), - updatedAt: toIsoString(membership.updatedAt), - archivedAt: toIsoString(membership.archivedAt), - })) ?? []; - - const organizationData = organization && { - id: organization.id, - name: organization.name, - urlKey: organization.urlKey, - allowedAuthServices: organization.allowedAuthServices, - allowMembersToInvite: organization.allowMembersToInvite, - customersEnabled: organization.customersEnabled, - feedEnabled: organization.feedEnabled, - gitBranchFormat: organization.gitBranchFormat, - gitLinkbackMessagesEnabled: organization.gitLinkbackMessagesEnabled, - gitPublicLinkbackMessagesEnabled: organization.gitPublicLinkbackMessagesEnabled, - initiativeUpdateReminderFrequencyInWeeks: - organization.initiativeUpdateReminderFrequencyInWeeks, - initiativeUpdateRemindersDay: organization.initiativeUpdateRemindersDay, - initiativeUpdateRemindersHour: organization.initiativeUpdateRemindersHour, - projectUpdateReminderFrequencyInWeeks: - organization.projectUpdateReminderFrequencyInWeeks, - projectUpdateRemindersDay: organization.projectUpdateRemindersDay, - projectUpdateRemindersHour: organization.projectUpdateRemindersHour, - projectUpdatesReminderFrequency: organization.projectUpdatesReminderFrequency, - restrictLabelManagementToAdmins: organization.restrictLabelManagementToAdmins, - restrictTeamCreationToAdmins: organization.restrictTeamCreationToAdmins, - roadmapEnabled: organization.roadmapEnabled, - samlEnabled: organization.samlEnabled, - scimEnabled: organization.scimEnabled, - releaseChannel: organization.releaseChannel, - fiscalYearStartMonth: organization.fiscalYearStartMonth, - slaDayCount: organization.slaDayCount, - previousUrlKeys: organization.previousUrlKeys, - logoUrl: organization.logoUrl, - createdIssueCount: organization.createdIssueCount, - customerCount: organization.customerCount, - periodUploadVolume: organization.periodUploadVolume, - userCount: organization.userCount, - trialEndsAt: toIsoString(organization.trialEndsAt), - deletionRequestedAt: toIsoString(organization.deletionRequestedAt), - archivedAt: toIsoString(organization.archivedAt), - createdAt: toIsoString(organization.createdAt), - updatedAt: toIsoString(organization.updatedAt), - }; - - const summaryIdentifier = user.name || user.displayName || user.email || user.id; + const summaryIdentifier = viewer.name || viewer.displayName || viewer.email || viewer.id; $.export("$summary", `Retrieved Linear user ${summaryIdentifier}`); return { - user, - organization: organizationData, - teams: { - nodes: teams, - pageInfo: toPageInfo(teamsConnection?.pageInfo), - }, - teamMemberships: { - nodes: teamMemberships, - pageInfo: toPageInfo(teamMembershipsConnection?.pageInfo), - }, + user: viewer, + organization, + teams: teamsConnection, + teamMemberships: teamMembershipsConnection, }; }, }; diff --git a/components/slack/actions/get-current-user/get-current-user.mjs b/components/slack/actions/get-current-user/get-current-user.mjs index 1ec7cd49a89db..bcb9b84cb8d5b 100644 --- a/components/slack/actions/get-current-user/get-current-user.mjs +++ b/components/slack/actions/get-current-user/get-current-user.mjs @@ -56,43 +56,13 @@ export default { || authContext.user || userId; - $.export( - "$summary", - `Retrieved Slack user ${summaryName}`, - ); + $.export("$summary", `Retrieved Slack user ${summaryName}`); return { authContext, - user: user && { - id: user.id, - teamId: user.team_id, - name: profile?.real_name_normalized || user.real_name, - displayName: profile?.display_name_normalized || user.name, - email: profile?.email, - locale: user.locale, - timezone: user.tz, - timezoneLabel: user.tz_label, - timezoneOffset: user.tz_offset, - isAdmin: user.is_admin, - isOwner: user.is_owner, - isPrimaryOwner: user.is_primary_owner, - isRestricted: user.is_restricted, - isUltraRestricted: user.is_ultra_restricted, - isBot: user.is_bot, - isAppUser: user.is_app_user, - updated: user.updated, - color: user.color, - profile, - }, - team: teamInfo?.team && { - id: teamInfo.team.id, - name: teamInfo.team.name, - domain: teamInfo.team.domain, - emailDomain: teamInfo.team.email_domain, - icon: teamInfo.team.icon, - enterpriseId: teamInfo.team.enterprise_id, - enterpriseName: teamInfo.team.enterprise_name, - }, + user, + profile, + team: teamInfo?.team, }; }, };