Skip to content

peakon_employee_voice: add 7 AI-optimized MCP actions#21015

Open
sergio-eliot-rodriguez wants to merge 12 commits into
masterfrom
mcp/peakon_employee_voice
Open

peakon_employee_voice: add 7 AI-optimized MCP actions#21015
sergio-eliot-rodriguez wants to merge 12 commits into
masterfrom
mcp/peakon_employee_voice

Conversation

@sergio-eliot-rodriguez
Copy link
Copy Markdown
Collaborator

@sergio-eliot-rodriguez sergio-eliot-rodriguez commented May 31, 2026

Summary

  • Adds 7 new AI-optimized actions for Peakon Employee Voice: get-engagement-overview, get-driver-scores, list-segments, list-employees, create-employee, update-employee, delete-employee
  • Updates the app file to use oauth_access_token as Bearer JWT directly (Pipedream's OAuth flow handles the Peakon token exchange) and adds a shared _makeRequest helper
  • All actions use static schemas (no additionalProps/reloadProps), correct MCP annotations (readOnlyHint, destructiveHint, openWorldHint), and cross-references between tools in descriptions

Test plan

  • All 7 evals pass at 100% (confirmed on staging account: pipedream.staging-peakon.com)
  • Lint passes (exit 0)
  • list-segments → returns 423 segments with contextId values
  • get-engagement-overview → scoped to segment via contextId
  • get-driver-scores → returns 14 driver scores with grade/impact
  • list-employees → filters by manager/admin/email/segmentIds
  • create-employee → POST with JSON API body, returns internal ID
  • update-employee → PATCH partial update including custom HR attributes
  • delete-employee → permanent DELETE, destructiveHint: true

Closes #20291

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Employee management: create, update, delete, and list employees with configurable filters and custom attributes
    • Engagement analytics: retrieve driver scores and an engagement overview (with interval, observations, participation options)
    • Segmentation: list demographic/organizational segments with filter options
  • Chores

    • Improved API integration with authenticated requests, richer prop-driven inputs, and package version bump

@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Jun 6, 2026 5:37pm

Request Review

@pipedream-component-development
Copy link
Copy Markdown
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a9c2f8de-49fb-4819-a6fc-f27fb5ca9dc0

📥 Commits

Reviewing files that changed from the base of the PR and between eed1b8b and 516aa7c.

📒 Files selected for processing (2)
  • components/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjs
  • components/peakon_employee_voice/actions/update-employee/update-employee.mjs

📝 Walkthrough

Walkthrough

Adds a Peakon Employee Voice component: app infra with authenticated requests, six actions (create/update/delete employee; list employees/segments; get driver scores and engagement overview), and bumps the component version to 0.1.0.

Changes

Peakon Employee Voice Component Implementation

Layer / File(s) Summary
App Foundation & Infrastructure
components/peakon_employee_voice/peakon_employee_voice.app.mjs
Replaces app stub with complete Pipedream app definition: imports axios, defines shared propDefinitions for contextId, interval, and employeeId, implements _baseUrl() to construct Peakon API host from OAuth subdomain/environment, and adds _makeRequest() helper to execute authenticated axios calls with Bearer token and optional params/data.
Employee Management (CRUD)
components/peakon_employee_voice/actions/create-employee/create-employee.mjs, components/peakon_employee_voice/actions/delete-employee/delete-employee.mjs, components/peakon_employee_voice/actions/update-employee/update-employee.mjs
Implements three employee actions: create-employee sends POST with required firstName/lastName/identifier and optional email/employeeType/employmentStatus, parsing customAttributes JSON; delete-employee sends DELETE with updated description clarifying irreversibility; update-employee sends PATCH with optional standard fields and merged custom attributes. All export $summary with operation details and return API responses.
Directory Operations (List)
components/peakon_employee_voice/actions/list-employees/list-employees.mjs, components/peakon_employee_voice/actions/list-segments/list-segments.mjs
Implements two list actions: list-employees supports optional filters (filterEmail, filterAccountId, filterAdmin, filterEmployeeId, filterManager, filterSegmentIds); list-segments supports optional filters (filterAttributeId, filterDirect, filterManagerId, filterType). Both construct query params from provided filters, call the Peakon API via app._makeRequest, and export $summary with result counts.
Analytics & Engagement Data
components/peakon_employee_voice/actions/get-driver-scores/get-driver-scores.mjs, components/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjs
Implements two engagement analytics actions: get-driver-scores queries the drivers endpoint with optional interval, observations, participation, and filterSegmentIds (exports driver count); get-engagement-overview queries the overview endpoint with optional boolean flags and formats mean engagement score to 2 decimals or N/A in $summary.
Component Version Bump
components/peakon_employee_voice/package.json
Updates package version from 0.0.1 to 0.1.0.

Sequence Diagram(s)

sequenceDiagram
  participant User as Action
  participant App as peakon_employee_voice.app
  participant Axios as axios
  participant PeakonAPI as Peakon API
  User->>App: Action calls this.app._makeRequest(path, method, params, data)
  App->>App: _baseUrl() builds URL
  App->>Axios: axios request with Bearer token, params, data
  Axios->>PeakonAPI: HTTP request to /api/v1/...
  PeakonAPI-->>Axios: API response
  Axios-->>App: return response
  App-->>User: return response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

User submitted

Suggested reviewers

  • michelle0927
  • mariano-pd
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding 7 AI-optimized MCP actions for the Peakon Employee Voice component.
Description check ✅ Passed The PR description comprehensively covers the summary of changes, test plan, and related issue. However, the versioning checklist items are not explicitly marked as completed.
Linked Issues check ✅ Passed The PR fully addresses issue #20291 by implementing all required MCP actions (list-segments, list-employees, get-engagement-overview, get-driver-scores, create-employee, update-employee, delete-employee) with proper OAuth integration and MCP annotations.
Out of Scope Changes check ✅ Passed All changes are in-scope: 7 new actions, app file enhancements with OAuth support and _makeRequest helper, and package.json version bump align with issue #20291 requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mcp/peakon_employee_voice

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pipedream-component-development
Copy link
Copy Markdown
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@components/peakon_employee_voice/actions/get-driver-scores/get-driver-scores.mjs`:
- Line 17: The component's version field in get-driver-scores (the line with
version: "0.0.2") should be set to the initial component version; change
version: "0.0.2" to version: "0.0.1" so the new action starts at 0.0.1 per the
per-component versioning rule.

In
`@components/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjs`:
- Around line 64-67: The summary export currently assumes score is not null and
calls score.toFixed(2); guard against null (and non-numeric) values by testing
the retrieved value before formatting—e.g., read score from
response.data?.attributes?.scores?.mean, then replace the condition score !==
undefined with a numeric check such as score != null && Number.isFinite(score)
(or typeof score === 'number'), and only call score.toFixed(2) when that check
passes; otherwise export "N/A" via the existing $.export("$summary", ...) call.

In `@components/peakon_employee_voice/actions/list-employees/list-employees.mjs`:
- Line 15: The component declares an incorrect initial version; in
components/peakon_employee_voice/actions/list-employees/list-employees.mjs
update the version field from "0.0.2" to the proper initial value "0.0.1" to
comply with the new-component versioning guideline (change the version: "0.0.2"
entry to version: "0.0.1").

In `@components/peakon_employee_voice/actions/list-segments/list-segments.mjs`:
- Line 13: This new component's version field is set incorrectly to "0.0.2";
update the version key in the file (the YAML/JSON "version" entry currently set
to 0.0.2) to "0.0.1" so the new component starts at the required initial version
per guidelines.

In
`@components/peakon_employee_voice/actions/update-employee/update-employee.mjs`:
- Around line 6-14: The description correctly cross-references the action named
"List Employees" and the suggested code change is to simplify how optional
standard fields are collected: locate where standardAttrs (or similar) is built
in update-employee (e.g., variable standardAttrs in update-employee.mjs) and
remove the extra truthiness checks (if/x && ...) so you directly assign the
optional properties (firstName, lastName, identifier, employmentStatus) from
inputs into the object (e.g., { firstName: inputs.firstName, lastName:
inputs.lastName, ... }); the platform will strip undefined values automatically,
so this eliminates unnecessary conditionals while leaving the description and
the "List Employees" reference unchanged.
- Around line 68-72: Replace the manual truthiness checks that build
standardAttrs with a direct object construction that includes the optional
properties (firstName, lastName, identifier, employmentStatus) so you don't
conditionally assign each field; update the code that sets standardAttrs (the
variable named standardAttrs and its uses of this.firstName, this.lastName,
this.identifier, this.employmentStatus) to simply create an object containing
those keys and rely on platform axios to strip undefined values.

In `@components/peakon_employee_voice/package.json`:
- Line 3: Update the package.json "version" field in
components/peakon_employee_voice from the patch bump "0.0.2" to a minor bump
like "0.1.0" because this PR adds new backward-compatible actions; locate the
"version" key in package.json and change its value accordingly, and ensure the
parent app's package.json version is bumped to the same or a greater semantic
segment to comply with the app/package versioning rule.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: bab3c266-692b-43a7-a8c5-9504f486a95b

📥 Commits

Reviewing files that changed from the base of the PR and between a0e69f4 and 3e2bf99.

📒 Files selected for processing (9)
  • components/peakon_employee_voice/actions/create-employee/create-employee.mjs
  • components/peakon_employee_voice/actions/delete-employee/delete-employee.mjs
  • components/peakon_employee_voice/actions/get-driver-scores/get-driver-scores.mjs
  • components/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjs
  • components/peakon_employee_voice/actions/list-employees/list-employees.mjs
  • components/peakon_employee_voice/actions/list-segments/list-segments.mjs
  • components/peakon_employee_voice/actions/update-employee/update-employee.mjs
  • components/peakon_employee_voice/package.json
  • components/peakon_employee_voice/peakon_employee_voice.app.mjs

Comment thread components/peakon_employee_voice/actions/get-driver-scores/get-driver-scores.mjs Outdated
Comment thread components/peakon_employee_voice/actions/list-employees/list-employees.mjs Outdated
Comment thread components/peakon_employee_voice/actions/list-segments/list-segments.mjs Outdated
Comment thread components/peakon_employee_voice/actions/update-employee/update-employee.mjs Outdated
Comment thread components/peakon_employee_voice/package.json Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
components/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjs (1)

65-67: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard score against null before calling toFixed().

score !== undefined still allows null, which will throw at runtime on score.toFixed(2).

🔧 Proposed fix
-    $.export("$summary", `Engagement overview retrieved — score: ${score !== undefined
-      ? score.toFixed(2)
+    $.export("$summary", `Engagement overview retrieved — score: ${typeof score === "number"
+      ? score.toFixed(2)
       : "N/A"}`);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@components/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjs`
around lines 65 - 67, The summary construction currently checks only "score !==
undefined" which permits null and causes a runtime error when calling
score.toFixed(2); update the guard used in the $.export("$summary", ...)
expression to ensure score is a valid number (e.g. check "score != null" or use
"typeof score === 'number'") before calling toFixed, and fall back to "N/A" when
the value is null/undefined or not a number.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In
`@components/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjs`:
- Around line 65-67: The summary construction currently checks only "score !==
undefined" which permits null and causes a runtime error when calling
score.toFixed(2); update the guard used in the $.export("$summary", ...)
expression to ensure score is a valid number (e.g. check "score != null" or use
"typeof score === 'number'") before calling toFixed, and fall back to "N/A" when
the value is null/undefined or not a number.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 352991c2-5a9a-45c6-abe7-3be2fcb30fed

📥 Commits

Reviewing files that changed from the base of the PR and between 3e2bf99 and e00e05f.

📒 Files selected for processing (5)
  • components/peakon_employee_voice/actions/get-driver-scores/get-driver-scores.mjs
  • components/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjs
  • components/peakon_employee_voice/actions/list-employees/list-employees.mjs
  • components/peakon_employee_voice/actions/list-segments/list-segments.mjs
  • components/peakon_employee_voice/package.json

Comment thread components/peakon_employee_voice/actions/create-employee/create-employee.mjs Outdated
Comment thread components/peakon_employee_voice/actions/list-segments/list-segments.mjs Outdated
Comment thread components/peakon_employee_voice/package.json
Sergio Eliot Rodriguez Wong and others added 10 commits June 6, 2026 10:58
Adds complete MCP tool coverage for Peakon Employee Voice:
- get-engagement-overview: engagement score, NPS, response rate scoped by contextId
- get-driver-scores: all 14 driver scores with grade/impact, segmentId filter
- list-segments: demographic/org segments with contextId values for analytics scoping
- list-employees: filter by email, accountId, admin, employeeId, manager, segmentIds
- create-employee: POST /api/v1/employees with JSON API body
- update-employee: PATCH partial update with standard + custom HR attributes
- delete-employee: permanent DELETE with destructiveHint annotation

App file updated: uses oauth_access_token directly as Bearer JWT (Pipedream's
OAuth flow handles the token exchange), adds _makeRequest helper.

Closes #20291

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All new actions must start at version 0.0.1 per registry convention.
Four actions (get-driver-scores, get-engagement-overview, list-employees,
list-segments) had been bumped to 0.0.2 during iterative development.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Minor bump (0.0.2 → 0.1.0) to reflect the addition of 7 new
backward-compatible actions rather than a pure patch change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e-employee.mjs


Our lagomorph friend is right on its truthiness checks advice.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
The upstream commit introduced a duplicate _makeRequest call and referenced
an undefined standardAttrs variable. Implement the intended change correctly:
build standardAttrs from defined-only fields, then use a single request.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
score !== undefined passes for null, causing a runtime crash. Replace with
score != null && Number.isFinite(score) before calling toFixed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add 7 wrapper methods to the app file (listSegments, listEmployees,
createEmployee, updateEmployee, deleteEmployee, getEngagementOverview,
getDriverScores) and update all actions to call these wrappers instead of
invoking _makeRequest directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Required by the app file's axios import from @pipedream/platform.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pipedream axios strips undefined values automatically. Replace all
if-checks and || undefined patterns with direct property assignment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sergio-eliot-rodriguez sergio-eliot-rodriguez force-pushed the mcp/peakon_employee_voice branch from 3a58a4a to 1c1efa5 Compare June 6, 2026 16:59
…line)

- get-driver-scores: quote all keys in params object for consistency
  (quote-props requires all or none when mixed bracket-notation keys present)
- app file: expand inline destructured method params to multi-line
  (object-curly-newline requires line breaks for multi-property objects)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sergio-eliot-rodriguez
Copy link
Copy Markdown
Collaborator Author

This ready for review again! @michelle0927

…employees

Options load all employees and display "Full Name (identifier)" as the label
with the internal numeric ID as the value, so users can pick by name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Components] peakon_employee_voice

4 participants