Add a tool for pending approvals
Managers ask “What’s waiting for my approval?” and “Are any timesheets still waiting on me?”. PeopleSoft’s workflow puts the items routed to each user on their worklist, so the answer is already in PeopleSoft. This guide adds a tool that reads it, scoped to the signed-in user, and returns only what the answer needs.
You’ll build: the GET /approvals operation in ZZ_ASSISTANT_HR, and the
list_pending_approvals tool.
Plan it
Section titled “Plan it”| Decision | For this tool |
|---|---|
| Input | None: the token identifies the user, and the API reads only their own worklist |
| Output | A count for each type of approval, the oldest item’s date, and a link to approve them |
| Security | ZZ_ASSIST_USER, like the other tools. A user with nothing waiting gets an empty list |
| Not in it | Who submitted each item, or what it’s for, which the answer doesn’t need |
Counts answer most questions managers ask, and keep other people’s details out of the conversation. If managers later need names, add them in a second version, limited to the items routed to the user.
Build the API
Section titled “Build the API”-
Map worklists to labels. Worklist names are technical, so create a small setup table, such as
ZZ_APPR_TYPE, that maps each worklist your managers approve from to a label they recognize, such as Timesheets or Absence requests. Worklists that aren’t in it aren’t counted. -
Count the open entries. The operation’s application class counts the user’s worklist entries that are still open, with
INSTSTATUS0 (available) or 1 (selected), by label:Open approvals, with %UserId bound to :1 SELECT T.ZZ_LABEL, COUNT(*), MIN(W.INSTAVAILABLEDTTM)FROM PSWORKLIST W, PS_ZZ_APPR_TYPE TWHERE W.OPRID = :1AND W.INSTSTATUS IN (0, 1)AND T.WORKLISTNAME = W.WORKLISTNAMEGROUP BY T.ZZ_LABELORDER BY 3 -
Add the link. Store the address of the page where managers approve, such as your approvals tile’s page, in a URL definition, such as
ZZ_APPROVALS, and return it with the counts. -
Create the operation as the
GETmethod of the root resourceapprovalsinZZ_ASSISTANT_HR, with OAuth 2.0 required, as in Build the first application service.
Write the description for the LLM
Section titled “Write the description for the LLM”The operation’s summary and description become the tool’s description, which the LLM reads to decide when to call it. Say what it answers, what it returns, and what it doesn’t:
Count the approvals waiting for the signed-in user, by type,with the date of the oldest item of each type. Use it forquestions about what the user needs to approve. It doesn't saywho submitted each item.Then add the tool to tools.yaml, with its progress message, and restart the service:
tools: list_pending_approvals: operation: GET /approvals progress: Looking for approvals waiting on youWhat happens
Section titled “What happens”A manager asks “Is anything waiting for my approval?”:
-
The LLM calls
list_pending_approvals, with no arguments. -
PeopleSoft runs the operation as the manager, after checking their token and their
ZZ_ASSIST_USERpermission list, and returns:The result {"total": 7,"approvals": [{ "type": "Timesheets", "count": 5,"oldest": "2026-09-18" },{ "type": "Absence requests", "count": 2,"oldest": "2026-09-22" }],"page": {"label": "Pending Approvals","url": "https://hr.example.com/psc/ps/EMPLOYEE/HRMS/..."}} -
The Assistant answers:
You have 7 items waiting for your approval: 5 timesheets, the oldest from 18 September, and 2 absence requests. You can approve them on the Pending Approvals page.
In the chat, the page name links to the URL in the result.
Check it
Section titled “Check it”- The manager’s counts match what they see on the approvals page.
- An employee with nothing waiting hears “Nothing is waiting for your approval”, not an error.
- An approval type that’s missing from the answer means its worklist isn’t in
ZZ_APPR_TYPEyet. - The audit log shows one call to
list_pending_approvals, with no arguments.
