peakon_employee_voice: add 7 AI-optimized MCP actions#21015
peakon_employee_voice: add 7 AI-optimized MCP actions#21015sergio-eliot-rodriguez wants to merge 12 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds 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. ChangesPeakon Employee Voice Component Implementation
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
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:
|
There was a problem hiding this comment.
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
📒 Files selected for processing (9)
components/peakon_employee_voice/actions/create-employee/create-employee.mjscomponents/peakon_employee_voice/actions/delete-employee/delete-employee.mjscomponents/peakon_employee_voice/actions/get-driver-scores/get-driver-scores.mjscomponents/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjscomponents/peakon_employee_voice/actions/list-employees/list-employees.mjscomponents/peakon_employee_voice/actions/list-segments/list-segments.mjscomponents/peakon_employee_voice/actions/update-employee/update-employee.mjscomponents/peakon_employee_voice/package.jsoncomponents/peakon_employee_voice/peakon_employee_voice.app.mjs
There was a problem hiding this comment.
♻️ Duplicate comments (1)
components/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjs (1)
65-67:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGuard
scoreagainstnullbefore callingtoFixed().
score !== undefinedstill allowsnull, which will throw at runtime onscore.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
📒 Files selected for processing (5)
components/peakon_employee_voice/actions/get-driver-scores/get-driver-scores.mjscomponents/peakon_employee_voice/actions/get-engagement-overview/get-engagement-overview.mjscomponents/peakon_employee_voice/actions/list-employees/list-employees.mjscomponents/peakon_employee_voice/actions/list-segments/list-segments.mjscomponents/peakon_employee_voice/package.json
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>
3a58a4a to
1c1efa5
Compare
…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>
|
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>
Summary
get-engagement-overview,get-driver-scores,list-segments,list-employees,create-employee,update-employee,delete-employeeoauth_access_tokenas Bearer JWT directly (Pipedream's OAuth flow handles the Peakon token exchange) and adds a shared_makeRequesthelperadditionalProps/reloadProps), correct MCP annotations (readOnlyHint,destructiveHint,openWorldHint), and cross-references between tools in descriptionsTest plan
pipedream.staging-peakon.com)list-segments→ returns 423 segments withcontextIdvaluesget-engagement-overview→ scoped to segment via contextIdget-driver-scores→ returns 14 driver scores with grade/impactlist-employees→ filters by manager/admin/email/segmentIdscreate-employee→ POST with JSON API body, returns internal IDupdate-employee→ PATCH partial update including custom HR attributesdelete-employee→ permanent DELETE, destructiveHint: trueCloses #20291
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores