# HR & Payroll Rules Oracle (`thenightowl/hr-payroll-oracle`) Actor

UAE and Saudi labour-law arithmetic: end-of-service gratuity, annual-leave accrual and encashment, notice periods, overtime, sick-leave pay, probation dates, wage breakdowns. MCP server + REST for AI agents. Every figure cites its article and official source with full workings. Not legal advice.

- **URL**: https://apify.com/thenightowl/hr-payroll-oracle.md
- **Developed by:** [Mohamad Najia](https://apify.com/thenightowl) (community)
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 lookup tool calls

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## HR & Payroll Rules Oracle — UAE and Saudi labour-law arithmetic for AI agents

**MCP server + REST API.** The numbers HR, payroll and legal-assistant agents must get right and usually guess: end-of-service
gratuity, annual-leave accrual and encashment, notice periods and pay in lieu, overtime, sick-leave pay, probation dates and
daily/hourly wage conventions — for the **UAE private sector (Federal Decree-Law 33/2021)** and **Saudi Arabia (Labor Law
M/51 with the February 2025 amendments)**.

Every result names the **article**, shows **each step** of the computation, cites the **official text**, and carries a
not-legal-advice disclaimer. Rules live in reviewable YAML with effective dates (e.g. Saudi notice 60/30 days from
19 Feb 2025, probation 180 days), so an agent gets the rule that applied on the date in question.

### Tools (8)

| tool | what | price |
|---|---|---|
| `end_of_service` | UAE Art. 51 (21/30 days' basic per year, 2-year cap, pro rata, unpaid days excluded); Saudi Art. 84/85/87 (½/1 month's actual wage, ⅓/⅔/full on resignation, Art. 87 full-award cases) | $0.01 |
| `annual_leave_entitlement` | accrual at a date (UAE 30/yr, 2/month between 6–12 months; Saudi 21 → 30 after 5 yrs), balance, encashment at the legal basis wage | $0.01 |
| `notice_period` | UAE Art. 43 (30–90 agreed) and probation Art. 9 (14 / 30 / 14 days); Saudi Art. 75 (60 employer / 30 employee from 2025) + pay in lieu and end date | $0.01 |
| `overtime_pay` | UAE Art. 19 (+25%, +50% night/rest day); Saudi Art. 107 (+50%) on basic hourly | $0.003 |
| `sick_leave_pay` | UAE Art. 31 (15 full / 30 half / 45 unpaid); Saudi Art. 117 (30 full / 60 at 75% / 30 unpaid) | $0.003 |
| `probation_rules` | legal maximum on the start date, end date, in-probation notices | $0.003 |
| `wage_breakdown` | daily/hourly basic and total wages (÷30, ÷8) and which basis each entitlement uses | $0.003 |
| `list_rules` | the full rule table per country with articles, figures, effective dates, scope notes and source URLs | free |

### Example

```json
// end_of_service {"country":"AE","start_date":"2019-03-01","end_date":"2026-10-31","basic_monthly_wage":8000,"termination":"resignation"}
{
  "result": {
    "eligible": true, "service_years": 7.6667, "basis_wage_monthly": 8000.0,
    "gross_award": 49333.33, "fraction_applied": 1.0, "cap": 192000.0, "gratuity": 49333.33,
    "legal_basis": "Art. 51", "payment_deadline_days": 14,
    "explanation": [
      "Service 2019-03-01 → 2026-10-31: 7y 8m 0d = 7.6667 years.",
      "Basis: BASIC wage 8000.0 → daily 266.67 (÷30).",
      "First 5 years: 5.0000 × 21 days × 266.67 = 28000.0.",
      "Beyond 5 years: 2.6667 × 30 days × 266.67 = 21333.33.",
      "Resignation does not reduce the gratuity under Decree-Law 33/2021."
    ]
  },
  "data_confidence": "high",
  "sources": ["https://u.ae/-/media/Mohre-2024/Federal-DecreeLaw-No-33-of-2021-...pdf", "https://u.ae/information-and-services/jobs/.../end-of-service-benefits-for-employees-in-the-private-sector"],
  "warnings": ["UAE/GCC nationals: pension law applies instead of gratuity (Art. 51(1)); DIFC/ADGM have their own regimes."],
  "disclaimer": "Arithmetic under the cited articles as publicly published; not legal advice. ..."
}
```

### Confidence, honestly

- **high** — UAE: computed from the official English text of the Decree-Law published by MOHRE.
- **medium** — Saudi: English translation of the Law plus the 2025 amendments as reported by law firms; figures are the published
  ones, but an official consolidated English text is not yet linked. `list_rules` shows every source.
- **Scope**: UAE onshore private sector only (DIFC/ADGM have separate laws; nationals are under pension law); Saudi private sector
  under the Labor Law. Collective terms and contracts can be more generous — pass the contract's figures.

### Connect

- **Apify (metered):** Standby URL + `/mcp`, header `Authorization: Bearer <your Apify token>`.
- **Self-hosted:** `claude mcp add hr-oracle --transport http https://hr.noahsarch.tech/mcp --header "X-API-Key: <key>"` — one Noah's Arch key works across all our agents.
- **REST:** `POST https://hr.noahsarch.tech/v1/tools/<tool>`; OpenAPI at `/openapi.json`.

### Not legal advice

This service performs arithmetic under published rules. Employment disputes turn on facts, contracts and court practice;
consult a licensed professional or the competent ministry (MOHRE, MHRSD) before acting on a figure.

***

### بالعربية

**عرّاف قواعد الموارد البشرية والرواتب** — خادم MCP وواجهة REST لحساب مستحقات العمل في الإمارات (المرسوم بقانون اتحادي 33 لسنة 2021)
والسعودية (نظام العمل م/51 مع تعديلات 2025): مكافأة نهاية الخدمة، رصيد الإجازة السنوية وبدلها، مهلة الإنذار وبدلها، العمل الإضافي،
أجر الإجازة المرضية، فترة التجربة، والأجر اليومي والساعي. كل نتيجة تذكر المادة والمصدر الرسمي وخطوات الحساب. حساب وفق النصوص المنشورة
وليس استشارة قانونية.

# Changelog

This Actor's version history is a separate document: https://apify.com/thenightowl/hr-payroll-oracle/changelog.md

# Actor input Schema

## Actor input object example

```json
{}
```

# Actor output Schema

## `mcpEndpoint` (type: `string`):

Point your MCP client here (Authorization: Bearer <Apify token>). 8 tools: end_of_service, annual_leave_entitlement, notice_period, overtime_pay, sick_leave_pay, probation_rules, wage_breakdown, list_rules.

## `readiness` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("thenightowl/hr-payroll-oracle").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("thenightowl/hr-payroll-oracle").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call thenightowl/hr-payroll-oracle --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,thenightowl/hr-payroll-oracle"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/7ppRzXZ9HJHx4XwR8/builds/jglYaS50K7WN7j2ea/openapi.json
