> ## Documentation Index
> Fetch the complete documentation index at: https://docs.melso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Melso MCP: https://mcp.melso.ai/mcp (OAuth; one company per connection). Documentation-search MCP: https://docs.melso.ai/mcp; it does not act on customer accounts. Melso API: https://api.melso.ai/v1, with a company API key or a partner key (early access); invoicing is live and the other operations are marked beta.
>
> Use the live tool list and respect company membership. Ask the person to approve the exact invoice or tax return version in the signed-in app. Melso's professionals prepare and file included returns after approval; an AI assistant does not file. A prepared file or an approval is not evidence of filing: only the AEAT's reference and receipt are. Keep credentials out of chat and logs.

# payroll_read MCP

> MCP payroll_read: read employees, monthly payrolls, payslips, official files and what the TGSS answered.

The monthly payroll. runs: months; run, payslip: one; preview: unsaved cost. file: official files. red\_responses: answers; siltra\_files: attempts; leaves: sick leaves; liquidations: TGSS terms. Actions (\* required): employees/runs/settings/liquidations; preview(year\*, month\*, start\_date\*, profile\*, end\_date, incidents); run/contract\_document/contract\_submissions/documents/changes/red\_responses/siltra\_files/request\_approval(id\*); payslip(id\*, payslip\_id\*); contracts(employee\_id\*); file(scope\*, contract\_ids, employee\_id, id, kind, year); leaves/strikes(employee\_id).

**Availability:** Self-employed / Company / Gestoría.

Listed to a company and to a self-employed person on Pro or Plus, unless the company switched Nóminas off in Settings → Modules.

**Gestoría:** every action but `file`, `request_approval`, in the client the call names: add `client`, the client's `id` from [`clients_read`](https://docs.melso.ai/mcp/tools/clients-read) `list`. [Melso for gestorías](https://docs.melso.ai/mcp/gestorias.md) explains what a firm's connection does.

The live tool list is authoritative: the company's plan and your role can narrow this contract. [Understand access](https://docs.melso.ai/mcp/permissions.md).

## When to use

Use `payroll_read` for `changes`, `contract_document`, `contract_submissions`, `contracts`, `documents`, `employees`, `file`, `leaves`, `liquidations`, `payslip`, `preview`, `red_responses`, `request_approval`, `run`, `runs`, `settings`, `siltra_files`, `strikes`. Use [`payroll`](https://docs.melso.ai/mcp/tools/payroll) for the companion actions. The live tool list determines availability.

## Input

```json theme={null}
{
  "additionalProperties": false,
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "employees"
        }
      },
      "required": [
        "action"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "preview"
        },
        "end_date": {
          "description": "The agreed end of a fixed-term contract, YYYY-MM-DD.",
          "type": "string"
        },
        "incidents": {
          "description": "What changed in the month, {} for nothing: overtime, overtime_force_majeure, bonus (incentives accrued in the month) and advance (already paid, deducted) as EUR decimal strings; periodic_bonuses [{concept, amount, from, to, source (convenio when the collective agreement sets it, else other)}], pay accrued over a longer period (YYYY-MM-DD, at most two years), taxed now and contributed by each month's share; unpaid_days; per_diems [{kind (overnight_spain, overnight_abroad, day_spain, day_abroad, flight_spain, flight_abroad), days (of the trips), amount (paid for meals), lodging (the hotel, with invoices; overnight only), long_stay (true past nine months in a row in the same place: nothing exempt)}], exempt up to art. 9 RIRPF's daily limit, the rest taxed and contributed; travel {km (driven in the employee's vehicle), mileage (paid for them, exempt up to 0.26 €/km), tolls (and parking, with receipts), public_transport (with tickets)}; in_kind [{kind (housing, rented_housing, car, car_delivery, loan, health_insurance, meal_vouchers, canteen, transport, nursery, training, other), concept, amount (its cost this month: rent, premium, vouchers, card, canteen cost, nursery, training, the car given; for other its market value), cadastral_value and cadastral_revised (revised in the last ten years) or property_value (without one) for housing and rented_housing, vehicle_value (cost with taxes, or market value new when vehicle_leased), private_use (percentage), efficiency (euro6, hybrid, electric, plug_in) and value_before_tax for a car, principal and interest_rate for a loan, persons and disabled for health_insurance, days (working days without exempt per diem) for meal_vouchers, cost (to the company, what it contributes) for other}], valued by art. 43 LIRPF with art. 42.3's exemptions, ask what each kind needs, never guess it; leaves [{kind (common or professional), start, end (the discharge; omit while it lasts), daily_base (omit: the law's, from earlier payslips), accident (true if from an accident), special (a common leave's art. 169.1.a situation: menstruation, pregnancy_interruption, pregnancy_week_39, donation, menopause, gender_violence), process_days (a relapse's days already in its process)}]; adjustments [{concept, amount (negative deducts), salary, contributes, taxable}]; arrears [{year, month (an earlier month it belongs to), amount, concept}], taxed now and contributed in that month's complementary liquidation (L03), the employee's share deducted now; termination {date, cause (resignation, trial_period, disciplinary, end_of_term, objective, objective_worker, collective, unfair), vacation_days (not taken), notice_days (not given: positive by the company, negative by the employee), agreed_severance (above the legal one)}, which makes the payslip the finiquito with its legal severance.",
          "type": "object"
        },
        "month": {
          "maximum": 12,
          "minimum": 1,
          "type": "integer"
        },
        "profile": {
          "description": "The contract and the modelo 145. Keys: nif; naf; category; group (1 to 11, the grupo de cotización); contract (indefinido, fijo_discontinuo, temporal, sustitucion, practicas, relevo); special_relationship; reta (true for a partner who controls the company and works in it, in the RETA as an autónomo societario: no Régimen General contributions, no group, no contract with the SEPE); administrator (true for pay for the office of administrator of such a partner: a fixed 35 %, or 19 % when last year's turnover was under 100.000 €, 190 key E); mutual_insurer (only such a partner's own mutua, its number from settings mutual_insurers; an employee's is the one of their contract's account; employee_update with reta false drops it and administrator); weekly_hours and full_time_hours (e.g. \"40\"; fewer weekly hours is part time); annual_salary (the year's base salary); salary_type (monthly, the default, or daily: daily_salary for each calendar day in alta and extra_days, the days of it each extra payment pays, with no annual_salary); payments (12 to 16) with extra_months, one per payment beyond 12 (e.g. [6, 12]); prorate_extra; complements [{concept, amount, optional compensation_type (salary or expense for the SMI check)}] a month; at_ep_rate (1.50 for office work); leave_complement (percent of the salary a leave is topped up to); tax, the modelo 145 {birth_year, family_situation (1 single parent, 2 spouse earning at most 1.500 €, 3 other), spouse_nif, disability (0, 33 or 65), reduced_mobility, geographic_mobility, ceuta_melilla, descendants [{birth_year, adoption_year, disability, reduced_mobility, whole}], ascendants [{birth_year, disability, reduced_mobility, cohabitants}], spousal_support, child_support, housing_loan, voluntary_rate}; year_to_date {year (required), paid, withheld, contributions}, what was paid earlier in the year, by another payroll of the company or another employer: the next payslip withholds the year's tax less what was already withheld, at most 47 %; irpf_mode, as the employee asks: annual (the default, counts year_to_date; another company's needs the employee's signed request, art. 88.5 RIRPF) or since_start (only what the company pays since the contract started); person, what the official files need {given_name, first_surname, second_surname, sex (F or M), birth_date, nationality (ISO code, ES), municipality (INE code, 5 digits), education (SEPE nivel formativo), iban (where the net is paid)}; seniority {years (the period, e.g. 3 for trienios), amount (a month per period), max, since, in_extras}; garnishments [{concept, debt (the total claimed), monthly (a fixed sum, as child support; otherwise the art. 607 LEC scale), reduction (0, 10 or 15 for family charges)}], withheld each month until the debt is paid. A new employee needs nif, group (but a partner in the RETA), contract, the hours, annual_salary (daily_salary when daily), payments, at_ep_rate and tax; employee_update takes only the keys that change. Amounts, hours and rates are decimal strings.",
          "type": "object"
        },
        "start_date": {
          "description": "The day the contract starts, YYYY-MM-DD.",
          "type": "string"
        },
        "year": {
          "description": "The year; Melso has the legal amounts of 2026.",
          "maximum": 2100,
          "minimum": 2026,
          "type": "integer"
        }
      },
      "required": [
        "action",
        "year",
        "month",
        "start_date",
        "profile"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "runs"
        }
      },
      "required": [
        "action"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "run"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "payslip"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        },
        "payslip_id": {
          "description": "The payslip's id, from run.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id",
        "payslip_id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "contracts"
        },
        "employee_id": {
          "description": "The employee's id, from employees.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "employee_id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "contract_document"
        },
        "id": {
          "description": "The contract's id, from contracts.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "contract_submissions"
        },
        "id": {
          "description": "The contract's id, from contracts.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "settings"
        }
      },
      "required": [
        "action"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "documents"
        },
        "id": {
          "description": "The employee's id, from employees.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "changes"
        },
        "id": {
          "description": "The employee's id, from employees.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "file"
        },
        "contract_ids": {
          "items": {
            "type": "string"
          },
          "maxItems": 1000,
          "minItems": 1,
          "type": "array"
        },
        "employee_id": {
          "description": "run and year scopes: only this employee's documents.",
          "type": "string"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        },
        "kind": {
          "description": "The file, by one of these names (scope siltra takes none). run: payslips, settlements, sepa, bases, vacation-bases, arrears-bases, rectification-bases, l90-bases, l91-bases, cra, afi, fdi, certifica, contrata; year: certificates, register; contract: contrata, afi; strike: afi, afi_end. fdi is the economic data of the month's sick leaves for the INSS, contrata the SEPE's Contrat@.",
          "type": "string"
        },
        "scope": {
          "enum": [
            "run",
            "year",
            "contract",
            "siltra",
            "strike"
          ],
          "type": "string"
        },
        "year": {
          "maximum": 2100,
          "minimum": 2000,
          "type": "integer"
        }
      },
      "required": [
        "action",
        "scope"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "red_responses"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "siltra_files"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "liquidations"
        }
      },
      "required": [
        "action"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "leaves"
        },
        "employee_id": {
          "description": "Only this employee's leaves, from employees.",
          "type": "string"
        }
      },
      "required": [
        "action"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "strikes"
        },
        "employee_id": {
          "description": "Only this employee's strikes, from employees.",
          "type": "string"
        }
      },
      "required": [
        "action"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "request_approval"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    }
  ],
  "properties": {
    "action": {
      "enum": [
        "employees",
        "preview",
        "runs",
        "run",
        "payslip",
        "contracts",
        "contract_document",
        "contract_submissions",
        "settings",
        "documents",
        "changes",
        "file",
        "red_responses",
        "siltra_files",
        "liquidations",
        "leaves",
        "strikes",
        "request_approval"
      ],
      "type": "string"
    },
    "contract_ids": {
      "items": {
        "type": "string"
      },
      "maxItems": 1000,
      "minItems": 1,
      "type": "array"
    },
    "employee_id": {
      "anyOf": [
        {
          "anyOf": [
            {
              "anyOf": [
                {
                  "description": "The employee's id, from employees.",
                  "type": "string"
                },
                {
                  "description": "run and year scopes: only this employee's documents.",
                  "type": "string"
                }
              ]
            },
            {
              "description": "Only this employee's leaves, from employees.",
              "type": "string"
            }
          ]
        },
        {
          "description": "Only this employee's strikes, from employees.",
          "type": "string"
        }
      ]
    },
    "end_date": {
      "description": "The agreed end of a fixed-term contract, YYYY-MM-DD.",
      "type": "string"
    },
    "id": {
      "anyOf": [
        {
          "anyOf": [
            {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "anyOf": [
                        {
                          "anyOf": [
                            {
                              "anyOf": [
                                {
                                  "anyOf": [
                                    {
                                      "description": "The month's payroll id, from runs.",
                                      "type": "string"
                                    },
                                    {
                                      "description": "The contract's id, from contracts.",
                                      "type": "string"
                                    }
                                  ]
                                },
                                {
                                  "description": "The contract's id, from contracts.",
                                  "type": "string"
                                }
                              ]
                            },
                            {
                              "description": "The employee's id, from employees.",
                              "type": "string"
                            }
                          ]
                        },
                        {
                          "description": "The employee's id, from employees.",
                          "type": "string"
                        }
                      ]
                    },
                    {
                      "description": "The month's payroll id, from runs.",
                      "type": "string"
                    }
                  ]
                },
                {
                  "description": "The month's payroll id, from runs.",
                  "type": "string"
                }
              ]
            },
            {
              "description": "The month's payroll id, from runs.",
              "type": "string"
            }
          ]
        },
        {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      ],
      "description": "employee_update and changes: the employee's id, from employees; run actions, red_responses and red_response_import: the month's payroll id, from runs; contract_update, contract_delete, contract_document, contract_submit and contract_submissions: the contract's id, from contracts; strike_record (to correct one) and strike_delete: the strike's id, from strikes; file with scope strike: the strike's id."
    },
    "incidents": {
      "description": "What changed in the month, {} for nothing: overtime, overtime_force_majeure, bonus (incentives accrued in the month) and advance (already paid, deducted) as EUR decimal strings; periodic_bonuses [{concept, amount, from, to, source (convenio when the collective agreement sets it, else other)}], pay accrued over a longer period (YYYY-MM-DD, at most two years), taxed now and contributed by each month's share; unpaid_days; per_diems [{kind (overnight_spain, overnight_abroad, day_spain, day_abroad, flight_spain, flight_abroad), days (of the trips), amount (paid for meals), lodging (the hotel, with invoices; overnight only), long_stay (true past nine months in a row in the same place: nothing exempt)}], exempt up to art. 9 RIRPF's daily limit, the rest taxed and contributed; travel {km (driven in the employee's vehicle), mileage (paid for them, exempt up to 0.26 €/km), tolls (and parking, with receipts), public_transport (with tickets)}; in_kind [{kind (housing, rented_housing, car, car_delivery, loan, health_insurance, meal_vouchers, canteen, transport, nursery, training, other), concept, amount (its cost this month: rent, premium, vouchers, card, canteen cost, nursery, training, the car given; for other its market value), cadastral_value and cadastral_revised (revised in the last ten years) or property_value (without one) for housing and rented_housing, vehicle_value (cost with taxes, or market value new when vehicle_leased), private_use (percentage), efficiency (euro6, hybrid, electric, plug_in) and value_before_tax for a car, principal and interest_rate for a loan, persons and disabled for health_insurance, days (working days without exempt per diem) for meal_vouchers, cost (to the company, what it contributes) for other}], valued by art. 43 LIRPF with art. 42.3's exemptions, ask what each kind needs, never guess it; leaves [{kind (common or professional), start, end (the discharge; omit while it lasts), daily_base (omit: the law's, from earlier payslips), accident (true if from an accident), special (a common leave's art. 169.1.a situation: menstruation, pregnancy_interruption, pregnancy_week_39, donation, menopause, gender_violence), process_days (a relapse's days already in its process)}]; adjustments [{concept, amount (negative deducts), salary, contributes, taxable}]; arrears [{year, month (an earlier month it belongs to), amount, concept}], taxed now and contributed in that month's complementary liquidation (L03), the employee's share deducted now; termination {date, cause (resignation, trial_period, disciplinary, end_of_term, objective, objective_worker, collective, unfair), vacation_days (not taken), notice_days (not given: positive by the company, negative by the employee), agreed_severance (above the legal one)}, which makes the payslip the finiquito with its legal severance.",
      "type": "object"
    },
    "kind": {
      "description": "The file, by one of these names (scope siltra takes none). run: payslips, settlements, sepa, bases, vacation-bases, arrears-bases, rectification-bases, l90-bases, l91-bases, cra, afi, fdi, certifica, contrata; year: certificates, register; contract: contrata, afi; strike: afi, afi_end. fdi is the economic data of the month's sick leaves for the INSS, contrata the SEPE's Contrat@.",
      "type": "string"
    },
    "month": {
      "maximum": 12,
      "minimum": 1,
      "type": "integer"
    },
    "payslip_id": {
      "description": "The payslip's id, from run.",
      "type": "string"
    },
    "profile": {
      "description": "The contract and the modelo 145. Keys: nif; naf; category; group (1 to 11, the grupo de cotización); contract (indefinido, fijo_discontinuo, temporal, sustitucion, practicas, relevo); special_relationship; reta (true for a partner who controls the company and works in it, in the RETA as an autónomo societario: no Régimen General contributions, no group, no contract with the SEPE); administrator (true for pay for the office of administrator of such a partner: a fixed 35 %, or 19 % when last year's turnover was under 100.000 €, 190 key E); mutual_insurer (only such a partner's own mutua, its number from settings mutual_insurers; an employee's is the one of their contract's account; employee_update with reta false drops it and administrator); weekly_hours and full_time_hours (e.g. \"40\"; fewer weekly hours is part time); annual_salary (the year's base salary); salary_type (monthly, the default, or daily: daily_salary for each calendar day in alta and extra_days, the days of it each extra payment pays, with no annual_salary); payments (12 to 16) with extra_months, one per payment beyond 12 (e.g. [6, 12]); prorate_extra; complements [{concept, amount, optional compensation_type (salary or expense for the SMI check)}] a month; at_ep_rate (1.50 for office work); leave_complement (percent of the salary a leave is topped up to); tax, the modelo 145 {birth_year, family_situation (1 single parent, 2 spouse earning at most 1.500 €, 3 other), spouse_nif, disability (0, 33 or 65), reduced_mobility, geographic_mobility, ceuta_melilla, descendants [{birth_year, adoption_year, disability, reduced_mobility, whole}], ascendants [{birth_year, disability, reduced_mobility, cohabitants}], spousal_support, child_support, housing_loan, voluntary_rate}; year_to_date {year (required), paid, withheld, contributions}, what was paid earlier in the year, by another payroll of the company or another employer: the next payslip withholds the year's tax less what was already withheld, at most 47 %; irpf_mode, as the employee asks: annual (the default, counts year_to_date; another company's needs the employee's signed request, art. 88.5 RIRPF) or since_start (only what the company pays since the contract started); person, what the official files need {given_name, first_surname, second_surname, sex (F or M), birth_date, nationality (ISO code, ES), municipality (INE code, 5 digits), education (SEPE nivel formativo), iban (where the net is paid)}; seniority {years (the period, e.g. 3 for trienios), amount (a month per period), max, since, in_extras}; garnishments [{concept, debt (the total claimed), monthly (a fixed sum, as child support; otherwise the art. 607 LEC scale), reduction (0, 10 or 15 for family charges)}], withheld each month until the debt is paid. A new employee needs nif, group (but a partner in the RETA), contract, the hours, annual_salary (daily_salary when daily), payments, at_ep_rate and tax; employee_update takes only the keys that change. Amounts, hours and rates are decimal strings.",
      "type": "object"
    },
    "scope": {
      "enum": [
        "run",
        "year",
        "contract",
        "siltra",
        "strike"
      ],
      "type": "string"
    },
    "start_date": {
      "description": "The day the contract started, YYYY-MM-DD.",
      "type": "string"
    },
    "year": {
      "anyOf": [
        {
          "description": "The year; Melso has the legal amounts of 2026.",
          "maximum": 2100,
          "minimum": 2026,
          "type": "integer"
        },
        {
          "maximum": 2100,
          "minimum": 2000,
          "type": "integer"
        }
      ]
    }
  },
  "required": [
    "action"
  ],
  "type": "object"
}
```

## Actions

The tool's schema combines the fields of every action. Each action accepts only its own fields below; send `action` with them.

### Read actions

These actions only read. They change nothing.

> [accordion] changes
>
> What changed in an employee's data and when, newest first, as the web app's history shows it.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The employee's id, from employees.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] contract\_document
>
> What the written employment contract of a registered contract would say, with the collective agreement's terms Melso holds, and what keeps it from being made: missing lists each fact to ask the person for (never write a placeholder or 'según convenio'; when the contract includes remote work, that list is every item of the acuerdo de trabajo a distancia, Ley 10/2021 art. 7, saved as document.remote\_agreement with remote\_work, and none of it is drafted), warnings what to tell them. agreement.classes lists the groups and levels the agreement describes, with the categories each covers: propose the one that fits the job and confirm it with the person; never change a fact only to see whether the document comes out. model names the SEPE's official model the PDF follows (indefinido for 100 and 200, temporal for 402, 502, 410 and 510, practica\_profesional for 420 and 520), its cláusulas específicas and its annexes (the essential elements, the covenant of complementary hours, the training plan); a clave without one keeps Melso's own layout. contract\_pdf makes the PDF once nothing is missing.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The contract's id, from contracts.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] contract\_submissions
>
> A contract's sends to Contrat@, the latest first, each with status (pending, received, rejected or unknown), its number or refusal, and the SEPE's verdict on the latest received one.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The contract's id, from contracts.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] contracts
>
> An employee's contracts as the SEPE and the Seguridad Social know them, oldest first: initial ones, extensions and conversions, each with its id, clave (code), dates, account, occupation, group, hours and the written contract's terms (document). The latest sets the employee's payroll terms.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "employee_id": {
>       "description": "The employee's id, from employees.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "employee_id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] documents
>
> An employee's documents: per contract, generated (the contract\_pdf PDF), basic\_copy (its copia básica, made with it), signed and notice, its documento informativo (RD 723/2026, RDL 39/2026): rule before\_start or on\_change (by due\_on), on\_request (request\_days días hábiles from requested\_on) or not\_required; delivered\_on, channel, file\_id (copy received), missing, overdue, late. agreements: each work centre's agreement. notice\_models: the SEPE's model; Melso does not fill it in. red\_resolutions: the resoluciones of altas and bajas done in Sistema RED (action, date, file\_id). file\_id is a Documentos file
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The employee's id, from employees.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] employees
>
> The company's employees: each one's id, name, start\_date, end\_date, active, settled\_on (the day an approved month's finiquito ended the contract; later months leave them out), leaving\_on (the date of a baja recorded in a draft month, until it is approved) and profile (the contract and the modelo 145 its payslips are calculated from). An empty profile ({}) keeps the employee out of the payroll until it is filled.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {},
>   "type": "object"
> }
> ```

> [accordion] file
>
> One of the official payroll files as content\_base64 (above 256 KB a person's own AI client gets download\_url, a link for 5 minutes, instead) with filename and content\_type; write the decoded bytes unchanged. scope run (id: a month): payslips and settlements (PDF, a zip when several; employee\_id narrows them to one). A month not approved yet gives these two named and stamped BORRADOR on every page, for the person to check, never to sign or hand over, and the communications whose term runs from the event, not the month (afi, fdi, certifica, contrata), from the month as it is now, to make again if it changes; its other files answer payroll\_not\_approved. From an approved month: sepa (the bank's pain.001 transfer order), bases, vacation-bases and arrears-bases (Sistema RED bases L00, L13 and L03), cra, afi (the month's bajas, and the strikes' starts and ends that fall in it, each once), fdi (the Fichero de Datos de IT: the economic data of the month's sick leaves, also those entered by hand), certifica (SEPE Certific\@2 certificates of the contracts that end) and contrata (SEPE Contrat@ of the month's contracts, extensions and conversions not communicated yet). scope year (year): certificates (withholding PDFs) and register (registro retributivo CSV). scope contract (contract\_ids, the employees' contracts kept in the web app): contrata (SEPE Contrat@ XML of contracts, extensions or conversions, one kind per file) and afi (altas and contract changes). scope strike (id: a strike, from strikes): afi, its MIN movements, the start with its tipo (2 total, 3 partial with the part of the day worked) and, once it has ended, the end on the first day back at work; afi\_end the end alone. Melso sends none of them but a contract to Contrat@ (contract\_submit): the gestoría or the company uploads them to SILTRA, Contrat@, Certific\@2 or the bank. A file the data does not allow names what it lacks (payroll\_file\_incomplete): complete the labour data (settings\_update) or the contract (contract\_update). At most 15 MB.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "contract_ids": {
>       "items": {
>         "type": "string"
>       },
>       "maxItems": 1000,
>       "minItems": 1,
>       "type": "array"
>     },
>     "employee_id": {
>       "description": "run and year scopes: only this employee's documents.",
>       "type": "string"
>     },
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     },
>     "kind": {
>       "description": "The file, by one of these names (scope siltra takes none). run: payslips, settlements, sepa, bases, vacation-bases, arrears-bases, rectification-bases, l90-bases, l91-bases, cra, afi, fdi, certifica, contrata; year: certificates, register; contract: contrata, afi; strike: afi, afi_end. fdi is the economic data of the month's sick leaves for the INSS, contrata the SEPE's Contrat@.",
>       "type": "string"
>     },
>     "scope": {
>       "enum": [
>         "run",
>         "year",
>         "contract",
>         "siltra",
>         "strike"
>       ],
>       "type": "string"
>     },
>     "year": {
>       "maximum": 2100,
>       "minimum": 2000,
>       "type": "integer"
>     }
>   },
>   "required": [
>     "scope"
>   ],
>   "type": "object"
> }
> ```

> [accordion] leaves
>
> The company's sick leaves (incapacidad temporal) as the INSS reported them in the FIE files imported, the open ones first: each one's employee\_id and employee\_name, status (open, discharged by the INSS, or cancelled when the INSS annulled the parte de baja), kind (common or professional) with accident, the INSS's contingency (1 common illness, 2 non-occupational accident, 3 accident at work, 4 occupational illness, 5 observation period), start, end (the discharge, empty while it lasts) with end\_cause, relapse with initial\_start and accumulated\_days, estimated\_days (the duration the parte de baja expects), next\_review, exhausts\_365 (the day it reaches 365 days), confirmations (each parte de confirmación's date and number), entity (the INSS's code of who pays the benefit) and account (the CCC). Every month's draft payroll takes the leaves that touch it; employee\_id narrows them to one employee.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "employee_id": {
>       "description": "Only this employee's leaves, from employees.",
>       "type": "string"
>     }
>   },
>   "type": "object"
> }
> ```

> [accordion] liquidations
>
> The company's approved months with the TGSS, the latest first, as the Seguridad Social tab of Nóminas lists them: today (the day in Spain) and liquidations, each with run\_id, period, run\_status, status (pending until a Fichero de Cálculos is imported, errors, differences or matches), imports (SILTRA files imported; 0 means none yet), errors and differences (counts; red\_responses with run\_id reads them), calculated, employees in the Régimen General, due (what the payroll pays the TGSS) and tgss (what the TGSS liquidated, once calculated), and terms: presentation (last day to send the bases and ask for the calculation, art. 29.2 LGSS), direct\_debit (last day to confirm the liquidation in SILTRA to pay by cargo en cuenta: the 22nd of the month after, the 20th in February and December; later it is paid electronically), charge (the day the bank charges it, the last working day of that month) and payment (the end of the term to pay it). Melso does not know what was confirmed or paid in SILTRA.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {},
>   "type": "object"
> }
> ```

> [accordion] payslip
>
> One payslip whole: its days, earnings and deductions line by line, the Seguridad Social bases and contributions, how the IRPF rate was calculated, the totals, warnings and the incidents it was calculated with.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     },
>     "payslip_id": {
>       "description": "The payslip's id, from run.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id",
>     "payslip_id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] preview
>
> Calculate one month's payslip for a contract without saving anything: what a hire, a raise or a change would cost the company and pay the employee, with the payslip's earnings, deductions, Seguridad Social bases and contributions, the IRPF rate and totals (company\_cost, net). It reads none of Melso's earlier payslips: for a month after January, profile.year\_to\_date gives what was paid, withheld and contributed earlier in the year, or the rate sees only the months left.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "end_date": {
>       "description": "The agreed end of a fixed-term contract, YYYY-MM-DD.",
>       "type": "string"
>     },
>     "incidents": {
>       "description": "What changed in the month, {} for nothing: overtime, overtime_force_majeure, bonus (incentives accrued in the month) and advance (already paid, deducted) as EUR decimal strings; periodic_bonuses [{concept, amount, from, to, source (convenio when the collective agreement sets it, else other)}], pay accrued over a longer period (YYYY-MM-DD, at most two years), taxed now and contributed by each month's share; unpaid_days; per_diems [{kind (overnight_spain, overnight_abroad, day_spain, day_abroad, flight_spain, flight_abroad), days (of the trips), amount (paid for meals), lodging (the hotel, with invoices; overnight only), long_stay (true past nine months in a row in the same place: nothing exempt)}], exempt up to art. 9 RIRPF's daily limit, the rest taxed and contributed; travel {km (driven in the employee's vehicle), mileage (paid for them, exempt up to 0.26 €/km), tolls (and parking, with receipts), public_transport (with tickets)}; in_kind [{kind (housing, rented_housing, car, car_delivery, loan, health_insurance, meal_vouchers, canteen, transport, nursery, training, other), concept, amount (its cost this month: rent, premium, vouchers, card, canteen cost, nursery, training, the car given; for other its market value), cadastral_value and cadastral_revised (revised in the last ten years) or property_value (without one) for housing and rented_housing, vehicle_value (cost with taxes, or market value new when vehicle_leased), private_use (percentage), efficiency (euro6, hybrid, electric, plug_in) and value_before_tax for a car, principal and interest_rate for a loan, persons and disabled for health_insurance, days (working days without exempt per diem) for meal_vouchers, cost (to the company, what it contributes) for other}], valued by art. 43 LIRPF with art. 42.3's exemptions, ask what each kind needs, never guess it; leaves [{kind (common or professional), start, end (the discharge; omit while it lasts), daily_base (omit: the law's, from earlier payslips), accident (true if from an accident), special (a common leave's art. 169.1.a situation: menstruation, pregnancy_interruption, pregnancy_week_39, donation, menopause, gender_violence), process_days (a relapse's days already in its process)}]; adjustments [{concept, amount (negative deducts), salary, contributes, taxable}]; arrears [{year, month (an earlier month it belongs to), amount, concept}], taxed now and contributed in that month's complementary liquidation (L03), the employee's share deducted now; termination {date, cause (resignation, trial_period, disciplinary, end_of_term, objective, objective_worker, collective, unfair), vacation_days (not taken), notice_days (not given: positive by the company, negative by the employee), agreed_severance (above the legal one)}, which makes the payslip the finiquito with its legal severance.",
>       "type": "object"
>     },
>     "month": {
>       "maximum": 12,
>       "minimum": 1,
>       "type": "integer"
>     },
>     "profile": {
>       "description": "The contract and the modelo 145. Keys: nif; naf; category; group (1 to 11, the grupo de cotización); contract (indefinido, fijo_discontinuo, temporal, sustitucion, practicas, relevo); special_relationship; reta (true for a partner who controls the company and works in it, in the RETA as an autónomo societario: no Régimen General contributions, no group, no contract with the SEPE); administrator (true for pay for the office of administrator of such a partner: a fixed 35 %, or 19 % when last year's turnover was under 100.000 €, 190 key E); mutual_insurer (only such a partner's own mutua, its number from settings mutual_insurers; an employee's is the one of their contract's account; employee_update with reta false drops it and administrator); weekly_hours and full_time_hours (e.g. \"40\"; fewer weekly hours is part time); annual_salary (the year's base salary); salary_type (monthly, the default, or daily: daily_salary for each calendar day in alta and extra_days, the days of it each extra payment pays, with no annual_salary); payments (12 to 16) with extra_months, one per payment beyond 12 (e.g. [6, 12]); prorate_extra; complements [{concept, amount, optional compensation_type (salary or expense for the SMI check)}] a month; at_ep_rate (1.50 for office work); leave_complement (percent of the salary a leave is topped up to); tax, the modelo 145 {birth_year, family_situation (1 single parent, 2 spouse earning at most 1.500 €, 3 other), spouse_nif, disability (0, 33 or 65), reduced_mobility, geographic_mobility, ceuta_melilla, descendants [{birth_year, adoption_year, disability, reduced_mobility, whole}], ascendants [{birth_year, disability, reduced_mobility, cohabitants}], spousal_support, child_support, housing_loan, voluntary_rate}; year_to_date {year (required), paid, withheld, contributions}, what was paid earlier in the year, by another payroll of the company or another employer: the next payslip withholds the year's tax less what was already withheld, at most 47 %; irpf_mode, as the employee asks: annual (the default, counts year_to_date; another company's needs the employee's signed request, art. 88.5 RIRPF) or since_start (only what the company pays since the contract started); person, what the official files need {given_name, first_surname, second_surname, sex (F or M), birth_date, nationality (ISO code, ES), municipality (INE code, 5 digits), education (SEPE nivel formativo), iban (where the net is paid)}; seniority {years (the period, e.g. 3 for trienios), amount (a month per period), max, since, in_extras}; garnishments [{concept, debt (the total claimed), monthly (a fixed sum, as child support; otherwise the art. 607 LEC scale), reduction (0, 10 or 15 for family charges)}], withheld each month until the debt is paid. A new employee needs nif, group (but a partner in the RETA), contract, the hours, annual_salary (daily_salary when daily), payments, at_ep_rate and tax; employee_update takes only the keys that change. Amounts, hours and rates are decimal strings.",
>       "type": "object"
>     },
>     "start_date": {
>       "description": "The day the contract starts, YYYY-MM-DD.",
>       "type": "string"
>     },
>     "year": {
>       "description": "The year; Melso has the legal amounts of 2026.",
>       "maximum": 2100,
>       "minimum": 2026,
>       "type": "integer"
>     }
>   },
>   "required": [
>     "year",
>     "month",
>     "start_date",
>     "profile"
>   ],
>   "type": "object"
> }
> ```

> [accordion] red\_responses
>
> What the TGSS answered about an approved month through SILTRA, as imported (imports: each file's kind, name, liquidation and summary), and the month's reconciliation with its payslips as they are now. status is pending until a Fichero de Cálculos is imported, errors, differences or matches (it cuadra). liquidations: each one's type (L00, L13, L03, L90, L91), number, TGSS state, confirmed, term\_ends and in\_term (the presentation term), and its total by Melso and the TGSS. messages: the current Respuesta's errors and warnings with code, severity, the TGSS's description, the manual's explanation and motive, and the employee, tramo and datum they are about (not\_processed: what the TGSS left out). differences: one row per employee, tramo (absent for the whole month) and concept, with kind (value, employee\_only\_tgss, employee\_only\_melso, tramo\_only\_tgss, tramo\_only\_melso, identity), concept code and label, measure (days, base, the employee's or the employer's quota, amount of a compensation, ipf), and Melso's value, the TGSS's and the difference. not\_compared: concepts Melso does not calculate, with the TGSS's amount. proposal: what mends each liquidation and the run file that does it (file action with scope run): bases again in term, rectification-bases for a confirmed one, after the term l90-bases for higher bases and l91-bases for what the TGSS never liquidated; cannot\_lower when the payroll has lower bases than the TGSS after the term.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] request\_approval
>
> Answer the authenticated web page where the company, or its gestoría, reviews a month: share approval\_url when the person wants to review it there. When they ask you to approve it, approve does it at the version they reviewed.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] run
>
> One month's payroll as runs lists it, with each payslip's id, employee, incidents, applied\_rate (the IRPF withholding rate), totals and warnings. payslip reads one payslip whole.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] runs
>
> The company's monthly payrolls, the latest first: each one's id, period (YYYY-MM), pay\_date, status (draft, approved, paid), version, issues (employees without a payslip and why) and totals (employees, gross, net, the employee's and the company's Seguridad Social, withholding, company\_cost, social\_security\_due, tax\_due).
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {},
>   "type": "object"
> }
> ```

> [accordion] settings
>
> The company's labour data and its version: the RED authorization, the CNAE, each Seguridad Social account (CCC) with its work centre, collective agreement code (REGCON) and mutua colaboradora (at\_ep\_insurer and common\_contingencies\_insurer, a number of mutual\_insurers, which lists each mutua's website, or inss: its employees' mutua for a leave or an accident at work), the account its salaries leave from, whether the staff has legal representatives, and the person who signs its contracts and certificates.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {},
>   "type": "object"
> }
> ```

> [accordion] siltra\_files
>
> An approved month's SILTRA cycle: confirmed (SILTRA says its L00 is confirmed), next\_kind (the file to send next, empty when none) and the files generated to send the TGSS, the latest attempt first, with id, attempt, kind, status (queued while Melso writes it, ready, failed with error code and message: payroll\_file\_incomplete names what the data lacks), filename, size, files (one per account), created\_at, finished\_at and what the TGSS answered: answer (awaiting until its SILTRA answer is imported, errors, accepted), errors (its latest Fichero de Respuesta's) and responses (each import's kind, filename, imported\_at and errors). red\_responses explains each error. Read it again until a queued attempt is ready; file with scope siltra and the attempt's id gives the file.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] strikes
>
> The employees' strikes as recorded, the latest first: each one's id, employee\_id, employee\_name, kind (total, or partial with worked, the thousandths of the usual day the employee worked: 750 is three quarters), start, end (the last day of strike, empty while it lasts) and return (the first day back at work). Every month's draft payroll takes the strikes that touch it: a total strike's days are neither paid nor contributed, a partial one's pay and contribute the part worked. The affiliation file (file, scope strike, kind afi) communicates each one to the Seguridad Social. employee\_id narrows them to one employee.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "employee_id": {
>       "description": "Only this employee's strikes, from employees.",
>       "type": "string"
>     }
>   },
>   "type": "object"
> }
> ```

## Output

`employees` returns each employee with `id`, `name`, dates, `active` and the `profile` their payslips are calculated from. `runs` returns the monthly payrolls, latest first, with `period`, `pay_date`, `status` (`draft`, `approved`, `paid`), `version`, `issues` and `totals`; `run` one month with its payslips and `payslip` one payslip whole. `preview` returns an unsaved payslip with `company_cost` and `net`. `file` returns an official file as `content_base64` with `filename` and `content_type`; a month not approved yet gives its payslips stamped BORRADOR. `request_approval` returns the `approval_url` of the month's review page. `liquidations`, `red_responses` and `siltra_files` return what the TGSS answered as imported; Melso does not know what was presented or paid in SILTRA.

The result uses MCP `content` blocks; JSON payloads are encoded in text and may also appear in `structuredContent`. Check `isError` before reading a success payload. When the server declares an `outputSchema`, it is reproduced below. Check the action result and its declared fields before reporting success.

## Example

Use the actions of this tool in the order shown; its companion tool covers the other actions. These are the `arguments` of each call, in order.

**1. List the months**

```json theme={null}
{
  "action": "runs"
}
```

**2. Read the draft month**

```json theme={null}
{
  "action": "run",
  "id": "11111111-1111-4111-8111-111111111111"
}
```

**3. Get the page where the person reviews it**

```json theme={null}
{
  "action": "request_approval",
  "id": "11111111-1111-4111-8111-111111111111"
}
```

The first call as a request. Use an OAuth access token issued for this MCP resource and replace the example identifiers with values from your own company.

```bash theme={null}
curl --fail-with-body https://mcp.melso.ai/mcp \
  -H "Authorization: Bearer $MELSO_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  --data-binary @- <<'JSON'
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "payroll_read",
    "arguments": {
      "action": "runs"
    }
  }
}
JSON
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.