Skip to main content
Glama

set_site_nginx_snippet

Set custom nginx config on the BorealHost host proxy — WebSocket, timeouts, headers.

Use this when configuring your container's own nginx is not enough because something in front of it is interfering. The host proxy sits between the internet and your container, and by default its catch-all location / does not do anything special per-site.

WEBSOCKETS: if your WebSocket endpoint returns 400 through your domain but upgrades correctly (101) when tested inside your container, the Upgrade header is being dropped in front of you. Add a location block that relays it:

location ^~ /your/ws/path/ {
    proxy_pass <your site's existing upstream>;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 3600;
    proxy_send_timeout 3600;
    error_page 502 503 504 =502;
}

When testing with curl, force HTTP/1.1 (curl --http1.1). A WebSocket handshake uses the Upgrade header, which is invalid in HTTP/2 — curl negotiates h2 with a CDN by default and the edge answers 400, which looks exactly like the bug you are trying to fix.

This config lives OUTSIDE the generated vhost, so it survives domain re-linking, autoconfig, plan changes and reprovisioning. Sending "" clears it.

Bounds — the file is parsed by a root process on a machine shared with BorealHost infrastructure, so only per-site proxy directives are accepted: location, proxy_pass, proxy_set_header, proxy_http_version, proxy_*_timeout, proxy_buffering, client_max_body_size, add_header, error_page, expires, gzip. root, alias, include, access_log, error_log, server and upstream are refused, and proxy_pass must target your own site's existing upstream. A rejection names the directive and why.

The config is validated with nginx -t before it is applied and rolled back automatically if it does not pass, so a mistake cannot take your site down.

Requires: API key with write scope.

Args: domain_name: Full domain name (e.g. "example.com") content: nginx config, or "" to clear it

Returns: {"domain": "example.com", "bytes": 214, "replaced": false}

Errors: NOT_FOUND: Domain not found VALIDATION_ERROR: Domain not linked to a site, a directive is not permitted, proxy_pass targets something other than your own upstream, or nginx rejected the config (the message says which)

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "domain_name": "<domain_name>",
      "content": "<content>"
    },
    "name": "set_site_nginx_snippet"
  }
}

Input Schema

NameRequiredDescriptionDefault
contentYes
domain_nameYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and it delivers extensively: it discloses that config lives outside the generated vhost and survives re-linking, reprovisioning, etc.; that sending '' clears it; that the file is parsed by a root process on a shared machine; the exact whitelist of accepted directives and refused ones; that validation via nginx -t occurs with automatic rollback; and the requirement for an API key with write scope. This is thorough behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

While the description is long, it is structured with clear sections (Intro, Use case, WebSockets example, Persistence, Bounds, Validation, Requires, Args, Returns, Errors) and every sentence earns its place. It front-loads the purpose and the primary use case. The length is justified by the complexity and security-sensitivity of the operation, and it avoids redundant or filler text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (directive whitelist, security implications, validation, rollback), the description covers all essentials: when to use, a practical example, constraints, persistence, clearing behavior, required auth scope, and detailed error semantics. It even preempts a common curl/h2 pitfall. Nothing an agent needs to call it correctly is missing, and the output schema is not present so the return details are included.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% (no descriptions in the JSON schema), so the description must fully explain both parameters. It does: domain_name as a full domain name (e.g., 'example.com') and content as nginx config string or '' to clear. It also describes the return object and error cases, which maps semantic meaning to each parameter's expected use. The description fully compensates for the schema's absence of detail.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise verb-resource pairing: 'Set custom nginx config on the BorealHost host proxy — WebSocket, timeouts, headers.' It distinguishes from siblings like get_site_nginx_snippet by explicitly targeting the host proxy rather than the container's own nginx. The domain of operation and the kind of customizations are stated clearly, leaving no ambiguity about what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit trigger condition: 'Use this when configuring your container's own nginx is not enough because something in front of it is interfering.' It also provides a concrete diagnostic scenario (WebSocket 400 vs 101) and even explains why curl defaults to HTTP/2 can mislead. While it doesn't name a specific alternative tool for reading, the context makes the when-to-use boundary unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.