laya-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LAYAMCP_HOST | No | 监听地址 | 127.0.0.1 |
| LAYAMCP_PORT | No | 监听端口 | 8077 |
| LAYAMCP_DEVICE | No | auto / cpu / cuda / mps | auto |
| LAYAMCP_MODELS | No | 常驻 checkpoint,逗号分隔或 all | english,multilingual |
| LAYAMCP_WARMUP | No | 启动时预热加载模型 | true |
| LAYAMCP_HF_TOKEN | No | 私有镜像或受限下载时使用 | |
| LAYAMCP_LOG_JSON | No | 结构化 JSON 日志 | true |
| LAYAMCP_MCP_PATH | No | MCP 挂载路径 | /mcp |
| LAYAMCP_LOG_LEVEL | No | DEBUG / INFO / WARNING / ERROR / CRITICAL | INFO |
| LAYAMCP_TRANSPORT | No | 传输方式: streamable-http / stdio / sse | streamable-http |
| LAYAMCP_API_PREFIX | No | REST 前缀 | /v1 |
| LAYAMCP_MAX_CHOICES | No | 单个 choice 问题最大候选数 | 60 |
| LAYAMCP_DOCS_ENABLED | No | 是否开启 /docs | true |
| LAYAMCP_DEFAULT_MODEL | No | 默认 checkpoint | english |
| LAYAMCP_MAX_QUESTIONS | No | 单次调用最大问题数 | 32 |
| LAYAMCP_WORKER_THREADS | No | 推理线程池大小 | 2 |
| LAYAMCP_MAX_STATE_CHARS | No | state 最大字符数 | 120000 |
| LAYAMCP_METRICS_ENABLED | No | 是否采集指标 | true |
| LAYAMCP_MARGIN_THRESHOLD | No | top1−top2 低于此值视为「近距平局」→ escalate | 0.05 |
| LAYAMCP_REQUEST_ID_HEADER | No | 请求 id 头名称 | x-request-id |
| LAYAMCP_AUTO_TASK_DETECTION | No | 自动识别语言/脚本/工作流并路由 | true |
| LAYAMCP_CONFIDENCE_THRESHOLD | No | 达到此置信度才可能判为 auto_execute | 0.80 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| decideA | Answer a typed question set about Returns calibrated answers plus a |
| decide_yes_noA | The cheapest useful call: one statement, a calibrated yes/no and a directive. Phrase |
| decide_shortlistA | Pick one of many labels without degrading the prompt budget. Laya scores every option inside a fixed token budget, so a 200-label
choice loses resolution. This embeds the state and each label, keeps the
top |
| route_requestA | Detect language/script and workflow, and name the checkpoint that fits. Microseconds of work, no model download or forward pass. Useful before deciding whether a request needs the multilingual checkpoint at all. |
| list_presetsA | Question sets you can pass as |
| describe_questionsA | Echo a question set back: ids, kinds, options and levels. Call this when you need the exact option labels before deciding (for example to map the answer back onto code branches). |
| should_escalateA | One call, one boolean answer: does a human need to see this? Asks three questions at once (risk, reversibility, whether a human is required), then reduces them to the strictest verdict. Use it as a gate in front of an irreversible step. |
| server_statusB | Readiness, loaded checkpoints, cache size and latency percentiles. |
| preload_warmupA | Force checkpoints into memory so later decisions are fast. Rarely needed: the HTTP server warms up at start. Call it only if you connect over stdio or the server was started with warmup disabled. Loading downloads hundreds of MB the first time, so expect a slow call. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| decide_before_acting | Fill-in template that turns an intended action into a question set. |
| triage_message | Route a message to a team and decide whether it needs a human. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| laya-guide | Question-writing guide, kind reference, and the contract's grade semantics. |
| laya-question-schema | The JSON schema accepted by `decide` and `describe_questions`. |
| laya-presets | Every preset with its questions, as JSON. |
| laya-status | Live readiness and latency, same payload as `server_status`. |
TDQS
Scored across 9 tools
Most tools have clearly distinct roles: decide variants differ by input shape (typed questions, single statement, many labels), while route_request, list_presets, describe_questions, and server tools are separate concerns. However, should_escalate and decide_yes_no both produce gate-like boolean verdicts, and an agent could confuse when to use one versus the other despite the descriptions.
All names use snake_case, and most follow a predictable verb_noun or verb pattern (decide_yes_no, decide_shortlist, route_request, list_presets, describe_questions, preload_warmup). Minor deviations are should_escalate (modal verb phrase) and server_status (noun phrase), but these are still readable and consistent enough.
Nine tools is well-scoped for a decision/inference server. The surface covers decision making, routing, preset introspection, and server health without excessive redundancy.
The set covers core decision workflows (single yes/no, typed questions, shortlisting), routing, preset listing/description, status, and warmup. Minor gaps include no explicit tool to inspect or configure checkpoints beyond status, and no direct way to answer multiple independent statements in one call, but these are workable around.