Skip to main content

Tool Catalog

Every tool MIA can call. There are 60 tool files under functions/pivotAiAgent/tools/, organized into 16 category folders. The main chat pipeline registers 51 of them; the onboarding / MIA Tips pipeline registers a 20-tool subset including 8 onboarding-only tools.

Each tool is a module that exports a definition (Anthropic tool schema with name, description, input_schema) and an execute(companyId, input, token, _reqId?, userId?, personaName?) function. The dispatcher is executeTool() in functions/pivotAiAgent/tools/index.ts:192. See Agent SDK for the architecture.

Tool-set membership

  • Main chat (51 tools): registered in TOOL_CATALOG at tools/index.ts:96. Sent to Sonnet on every /api/chat data-path request via buildToolSet() — Sonnet picks what it needs.
  • Onboarding / MIA Tips (20 tools): imported individually in functions/pivotAiAgent/onboarding-pipeline.ts via its own ONBOARDING_TOOL_MAP. Used by both the new-owner onboarding flow and the MIA Tips configuration UI (differentiated by a flow parameter).
  • Always loaded for main chat (CORE_TOOL_DEFINITIONS, tools/index.ts:163): find_employee, get_current_user, set_user_rule, update_company_memory. These are mentioned explicitly so they're not dependent on category-based filtering.

A comment at the top of tools/index.ts mentions a search_tools meta-tool for on-demand discovery. This is aspirational — there is no search_tools in the registered set today; all tools are loaded up front.

Employees (11)

ToolFileDescriptionKey inputsMutates?
get_employeesemployees/getEmployees.tsList employees with optional filters (role, name search, archived). Optional fields array to slim payload.role?, search?, archived?, fields?[]No
find_employeeemployees/findEmployee.tsResolve employee by name to canonical ID. Call before any tool that needs an employee ID.nameNo
get_employee_ratesemployees/getEmployeeRates.tsHourly rates per employee per position.(none)No
get_current_useremployees/getCurrentUser.tsInfo on the calling manager (name, email, role, ID).(none)No
get_employee_availabilityemployees/getEmployeeAvailability.tsWeekly availability windows, max days/hours, preferences.employeeId?No
get_employee_days_offemployees/getEmployeeDaysOff.tsApproved days off in a date range.startDate, endDate, employeeId?No
create_employeeemployees/createEmployee.tsCreate one employee; optionally send invitation email.name, surname, positions, email?, phone?, ...Yes
batch_create_employeesemployees/batchCreateEmployees.tsBulk create from raw CSV.csvTextYes
update_employeeemployees/updateEmployee.tsPatch employee profile fields (allow-listed).employeeId, field overridesYes
archive_employeeemployees/archiveEmployee.tsSoft-delete an AI-created employee (must have createdByPivotAiAgent flag).employeeIdYes
update_employee_positionsemployees/updateEmployeePositions.tsUpdate assigned positions/roles with priority + history.employeeId, positions[]Yes

Schedule (6)

ToolFileDescriptionKey inputsMutates?
get_scheduleschedule/getSchedule.tsShifts in a date range; filter by employee/position; toggle draft/manual.startDate, endDate, employeeId?, positionId?, includeManual?, includeDraft?No
create_shiftschedule/createShift.tsCreate a shift. Tech debt: writes WeeklySchedule/{cid}/{date} directly via Firebase REST because the schedule module has no "create published shift" endpoint yet. File has TODO(refacto-endpoint).date, employeeId, startTime, endTimeYes
update_shiftschedule/updateShift.tsUpdate an existing shift (pass locator fields from get_schedule).shiftId, date, employeeId, ...Yes
delete_shiftschedule/deleteShift.tsRemove a shift.shiftId, date, employeeId, positionId, subRoleId, modeYes
update_schedule_templateschedule/updateScheduleTemplate.tsUpdate the weekly template for a specific role (or copy across roles).roleId, templateYes
set_schedule_template (onboarding-only)schedule/setScheduleTemplate.tsWrite the full weekly daysStructure. Used when the user uploads a picture of an existing schedule.daysStructureYes

Attendance (6)

ToolFileDescriptionKey inputsMutates?
get_attendanceattendance/getAttendance.tsClock punches in a date range.startDate, endDate, employeeId?No
get_payroll_issuesattendance/getPayrollIssues.tsAnomaly detector: ghost punches, overtime, short shifts, labor variance.startDate, endDate, employeeId?No
get_payroll_settingsattendance/getPayrollSettings.tsEffective payroll config (global + latest-period merge).(none)No
update_payroll_settingsattendance/updatePayrollSettings.tsUpdate payroll settings (frequency, rounding, overtime, tipping, ...).various optional fieldsYes
get_tips_dataattendance/getTipsData.tsTip-out distribution entries (how tips split per shift) — not gross tips earned.startDate, endDate, employeeId?No
add_manual_punchattendance/addManualPunch.tsInsert manual clock-in/out entries (batch).entries[]Yes

Requests (3)

ToolFileDescriptionKey inputsMutates?
get_requestsrequests/getRequests.tsEmployee requests (time-off, swap, replace, availability, emergency). Latest 50.type, status?No
approve_requestrequests/approveRequest.tsApprove a request.requestId/notificationId, typeYes
decline_requestrequests/declineRequest.tsDecline a request, optional reason.requestId/notificationId, type, reason?Yes

AI Memory (5)

ToolFileDescriptionKey inputsMutates?
set_user_ruleai-memory/setUserRule.tsSave a persistent manager rule ("always do X", "never show Y").ruleYes
list_user_rulesai-memory/listUserRules.tsList all saved rules.(none)No
delete_user_ruleai-memory/deleteUserRule.tsDelete a rule by ID.ruleIdYes
update_company_memoryai-memory/updateCompanyMemory.tsUpdate learned company facts (revenue, labor budget, peak days, ...).updates (object)Yes
set_cron_taskai-memory/setCronTask.tsSchedule a recurring AI report.taskName, schedule, description, recipient?Yes

Tips Rules (4)

ToolFileDescriptionKey inputsMutates?
save_ai_tips_ruletips-rules/saveAiTipsRule.tsCreate a tip-distribution rule (strict 30+ field canonical schema).variableName, variableLabelFr, variableLabelEn, kind, sourceRoleIds?, ...Yes
update_ai_tips_ruletips-rules/updateAiTipsRule.tsPatch an existing rule.ruleId, partial fieldsYes
delete_ai_tips_ruletips-rules/deleteAiTipsRule.tsRemove a rule.ruleIdYes
list_ai_tips_rulestips-rules/listAiTipsRules.tsList active rules sorted by priority.(none)No

Company (4)

ToolFileDescriptionKey inputsMutates?
get_company_infocompany/getCompanyInfo.tsCompany name, jobs/positions, timezone, settings. fields to slim payload.fields?[]No
get_company_settingscompany/getCompanySettings.tsDetailed config: schedule rules, attendance flags, feature toggles.(none)No
update_company_settingscompany/updateCompanySettings.tsUpdate schedule rules, feature toggles, company info, visibility policies.partial fieldsYes
get_integration_statuscompany/getIntegrationStatus.tsActive POS / payroll / reservation integrations grouped by category.(none)No

Posts (2)

ToolFileDescriptionKey inputsMutates?
get_postsposts/getPosts.tsRecent group-feed posts with comment + reaction counts.(none)No
create_postposts/createPost.tsText-only announcement to the group feed.textYes

Chat (3)

The employee-to-employee chat module, not the AI chat.

ToolFileDescriptionKey inputsMutates?
get_chatschat/getChats.tsList the manager's chat conversations.(none)No
get_chat_messageschat/getChatMessages.tsRecent messages in one chat (call get_chats first for the ID).chatIdNo
send_chat_messagechat/sendChatMessage.tsSend a text message on behalf of the manager.chatId, messageYes

Applicants (2)

ToolFileDescriptionKey inputsMutates?
get_applicantsapplicants/getApplicants.tsAll applicants with status, contact, positions, availability.status?No
update_applicant_statusapplicants/updateApplicantStatus.tsMove applicant through pipeline (does not hire — UI required).applicantId, statusYes

Sales (1)

ToolFileDescriptionKey inputsMutates?
get_salessales/getSales.tsPOS sales: totals, tips, transactions, per-hour, ratios. Multiple grouping options.startDate, endDate, groupBy?, period?, hours?, source?, employeeId?, ...No

Documents (1)

ToolFileDescriptionKey inputsMutates?
upload_employee_documentdocuments/uploadEmployeeDocument.tsGenerate styled PDF and upload to employee's profile (warning, write-up, compliance, etc.). Honors locale from find_employee.employeeId, title, content, documentType?Yes

Research (2)

ToolFileDescriptionKey inputsMutates?
web_searchresearch/webSearch.tsBrave Search (DuckDuckGo fallback) for current events, labor laws, weather alerts, etc. External API.query, count?No
lookup_pivot_helpresearch/pivotKnowledgeBase.tsPivot app knowledge base — how-to guides, feature docs, troubleshooting.queryNo

Weather (1)

ToolFileDescriptionKey inputsMutates?
get_weatherweather/getWeather.tsOpen-Meteo geocoding + archive/forecast. Public API, no auth.location, startDate, endDate, includeHistorical?No

Calculator (1)

ToolFileDescriptionKey inputsMutates?
calculatecalculator/calculate.tsDeterministic arithmetic — Mia must never do math in her head. Many ops: add, sub, mul, div, percent_of, cap_max, floor_min, round, divide_equally, sum, avg, min, max, abs, neg.op, then op-specific fieldsNo

Onboarding (8) — onboarding/MIA Tips pipeline only

ToolFileDescriptionKey inputsMutates?
research_businessonboarding/researchBusiness.tsLook up business by name (Brave Search) for address, industry, size.businessName, location?No
create_companyonboarding/createCompany.tsCreate the Pivot company. Uses POST /companiesApi/companies + several PATCH /companies/{id} calls with Mia's privileged token. Falls back to Admin SDK for paths without an endpoint: AIOnboardingSessions/, Companies/{cid}/businessProfile, Users/{uid}/signupPhase.name, address, ...Yes
create_positionsonboarding/createPositions.tsCreate the company's job categories and subcategories.positions[]Yes
get_onboarding_statusonboarding/getOnboardingStatus.tsResume an onboarding session — return checklist and next step.(none)No
complete_onboardingonboarding/completeOnboarding.tsMark onboarding complete; flips onboardingCompleted: true.companyId?Yes
import_competitor_csvonboarding/importCompetitorCsv.tsParse Agendrix / 7shifts CSV export, stage into ImportStagingArea/, then import.csvText, format, timezone?Yes
scrape_agendrixonboarding/scrapeAgendrix.tsLog into Agendrix on the user's behalf, scrape roster, import.email, password, businessNameYes
scrape_7shiftsonboarding/scrape7shifts.tsSame as scrape_agendrix but for 7shifts.email, password, businessNameYes

Onboarding-pipeline tool set (20)

The onboarding pipeline does not load the full main-chat catalog. Its 20-tool set is the 8 onboarding tools above, plus a curated subset:

  • find_employee, get_employees, create_employee, batch_create_employees, update_employee
  • get_company_info
  • set_schedule_template
  • save_ai_tips_rule, update_ai_tips_rule, delete_ai_tips_rule, list_ai_tips_rules
  • calculate

The MIA Tips frontend (src/routes/MiaTips/) uses the same backend pipeline with a flow parameter; that's why the tips rule tools live in the onboarding set rather than the main set.

What the "Mutates?" column means

Yes = the tool writes server-side state when it runs (new RTDB rows, status updates, files in Storage, emails sent, Temporal schedules created, etc.). No = the tool is a pure read or an external lookup that leaves the Pivot side unchanged.

The architectural call path is the same either way (executeToolglobalThis.fetch → internal endpoint with the user's Bearer token). The difference is just what the endpoint on the other side does. Because the user's token is forwarded, a mutating tool can only mutate things the calling user has permission to mutate — the AI inherits the user's auth scope. See Security Model: tools inherit user permissions.

Mutation summary

26 tools mutate state (~43%). 34 are read-only or external (~57%). Two tools (create_shift and the onboarding tools) currently bypass the standard HTTP path for some writes — that's tech debt for RTDB paths that don't have an endpoint yet, not an architectural exception. See Agent SDK: exceptions.