# Embed — canonical payload contracts

Local multilingual MiniLM embeddings (384-d). Same model the host Signal Engine already uses. 1 credit per 1 million accrued tokens (typical call is 0).

**Service id:** `embed`  
**Docs:** [https://mcp.glc-rag.hu/guide/embed](https://mcp.glc-rag.hu/guide/embed)  
**Markdown docs:** [https://mcp.glc-rag.hu/guide/embed.md](https://mcp.glc-rag.hu/guide/embed.md)  
**MCP resource:** `docs://embed/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`.

## `embed_status`

Health of the local MiniLM embedding server: model, dimensions, upstream reachability. Free — 0 credits.

Health of the local MiniLM server. Free.

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

**Request contract**

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

**Input schema**

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

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

```json
{
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "upstream_ok": {
      "type": "boolean"
    },
    "model": {
      "type": "string"
    },
    "dimensions": {
      "type": "integer"
    },
    "base_url": {
      "type": "string"
    },
    "tokens_per_credit": {
      "type": "integer"
    },
    "error": {
      "type": "string"
    }
  },
  "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
}
```

## `embed_texts` — Embed texts

Embed one or more texts with multilingual MiniLM (384-d, normalized). Pass `text` and/or `texts`. 1 credit per 1 million accrued tokens (a short call is 0).

text or texts[] → 384-d unit vectors. 1 credit per 1_000_000 accrued tokens (no per-call floor). is_error = 0.

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

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "embed_texts",
    "arguments": {
      "text": "<string, optional, minLength 1, maxLength 8192>",
      "texts": [
        "<string, optional, minLength 1, maxLength 8192>"
      ]
    }
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "minLength": 1,
      "maxLength": 8192,
      "description": "Single text to embed"
    },
    "texts": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 8192
      },
      "minItems": 1,
      "maxItems": 32,
      "description": "Batch of texts to embed (same order in the response)"
    }
  },
  "additionalProperties": false
}
```

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

```json
{
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "model": {
      "type": "string"
    },
    "dimensions": {
      "type": "integer"
    },
    "count": {
      "type": "integer"
    },
    "embeddings": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    },
    "usage": {
      "type": "object",
      "properties": {
        "prompt_tokens": {
          "type": "integer"
        },
        "total_tokens": {
          "type": "integer"
        }
      }
    },
    "prompt_tokens": {
      "type": "integer"
    },
    "unbilled_tokens": {
      "type": "integer"
    },
    "tokens_per_credit": {
      "type": "integer"
    },
    "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
}
```
