# Laya — canonical payload contracts

Multilingual decisions on CPU. Send text, questions, and the allowed answers; the model picks one answer per question. 1 credit per 10 questions.

**Service id:** `laya`  
**Docs:** [https://mcp.glc-rag.hu/guide/laya](https://mcp.glc-rag.hu/guide/laya)  
**Markdown docs:** [https://mcp.glc-rag.hu/guide/laya.md](https://mcp.glc-rag.hu/guide/laya.md)  
**MCP resource:** `docs://laya/payload`

POST `https://mcp.glc-rag.hu/mcp`. Values below are **type slots** from the live input schema (e.g. `<string, required>`), not example data. Fill them from the user task.

RPC result wrapper: `result.structuredContent` is the object in **Output schema**. `result.isError` mirrors `structuredContent.is_error`.

## `laya_status`

Whether the Laya multilingual checkpoint is loaded, plus the CPU thread budget. Free — 0 credits.

Model load state and CPU thread budget. Free.

**Required arguments:** _(none)_

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "laya_status",
    "arguments": {}
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

**Output schema** (`structuredContent` on success)

```json
{
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "loaded": {
      "type": "boolean"
    },
    "model": {
      "type": "string"
    },
    "device": {
      "type": "string"
    },
    "cpu_threads": {
      "type": "integer"
    },
    "max_len": {
      "type": "integer"
    },
    "head_max_len": {
      "type": "integer"
    },
    "questions_per_credit": {
      "type": "integer"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "additionalProperties": true,
  "required": [
    "ok",
    "model",
    "device"
  ]
}
```

**Error object**

```json
{
  "type": "object",
  "required": [
    "error",
    "is_error"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean",
      "const": true
    }
  },
  "additionalProperties": true
}
```

## `laya_decide` — Decide

Pick one allowed answer per question. Pass `text` and `questions` (each with `id`, `question`, and `options`). 1 credit per 10 questions, rounded up. Same call returns the choices.

text + questions[].options → one chosen answer per question. 1 credit per 10 questions (rounded up). is_error = 0.

**Required arguments:** `text`, `questions`

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "laya_decide",
    "arguments": {
      "text": "<string, required, minLength 1, maxLength 40000>",
      "questions": [
        {
          "id": "<string, required, minLength 1, maxLength 64>",
          "question": "<string, required, minLength 1, maxLength 500>",
          "options": [
            "<string, optional, minLength 1, maxLength 200>"
          ]
        }
      ]
    }
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "text",
    "questions"
  ],
  "properties": {
    "text": {
      "type": "string",
      "minLength": 1,
      "maxLength": 40000,
      "description": "Text the questions are about"
    },
    "questions": {
      "type": "array",
      "minItems": 1,
      "maxItems": 32,
      "description": "Questions and the answers the model may pick",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "question",
          "options"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "question": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "options": {
            "type": "array",
            "minItems": 2,
            "maxItems": 64,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        }
      }
    }
  }
}
```

**Output schema** (`structuredContent` on success)

```json
{
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "model": {
      "type": "string"
    },
    "device": {
      "type": "string"
    },
    "max_len": {
      "type": "integer"
    },
    "head_max_len": {
      "type": "integer"
    },
    "questions": {
      "type": "integer"
    },
    "answers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "answer": {
            "type": "string"
          },
          "confidence": {
            "type": [
              "number",
              "null"
            ]
          },
          "scores": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          }
        },
        "required": [
          "id",
          "answer"
        ]
      }
    },
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean"
    }
  },
  "additionalProperties": true,
  "required": [
    "ok"
  ]
}
```

**Error object**

```json
{
  "type": "object",
  "required": [
    "error",
    "is_error"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean",
      "const": true
    }
  },
  "additionalProperties": true
}
```
