mcp-controld 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -186,6 +186,18 @@ Create a second, write-scoped token in the Control D dashboard, then add it alon
186
186
 
187
187
  With no write token the write tools do not exist. Your client cannot list them and a prompt cannot call them, so a bad prompt cannot change your DNS setup.
188
188
 
189
+ ## Protocol support
190
+
191
+ The server speaks MCP 2026-07-28 and every older revision from 2024-10-07 to 2025-11-25, on the same command. Your client picks the revision when it connects. There is nothing to configure.
192
+
193
+ On connect the server sends short instructions: start with `controld_list_profiles`, then `controld_get_profile_config` with section `all`.
194
+
195
+ The server also serves a skill, `controld-mcp`, through the MCP [Skills extension](https://modelcontextprotocol.io/extensions/skills/overview): how Control D picks an action, the rule and log codes, and recipes such as finding out why a site is blocked. A client that supports the extension loads it from the server, so the skill always matches the server version. Nothing to install.
196
+
197
+ A failed tool call returns a normal result with `isError: true` and a short plain-text message. When Control D rejects a request, the message is Control D's own text followed by the HTTP status and the Control D error code, for example `This profile does not exist (HTTP 404, code 40401)`. A bad argument gets an input validation message that names the argument. Tokens never appear in that text. Calling a tool name that does not exist is rejected with JSON-RPC error -32602.
198
+
199
+ Every tool carries MCP annotations. The 13 read and diagnostic tools have `readOnlyHint: true`. Write tools have `readOnlyHint: false`. The delete tools, `controld_deauthorize_ips`, and `controld_request_write` also have `destructiveHint: true`.
200
+
189
201
  ## Tool reference
190
202
 
191
203
  Profile, device, access, and log tools accept an optional `sub_org_id` when you are acting on a sub-organization.
@@ -245,7 +257,7 @@ Registered only when a write credential is configured: either `CONTROLD_API_TOKE
245
257
 
246
258
  `controld_export_dns_query_logs` uses Control D's CSV analytics endpoint, because there is no documented JSON REST API for dashboard query logs. It needs Full Analytics on the device, takes a bounded time window, and caps the response size. It works on personal accounts, where the analytics endpoint is discovered from the account record.
247
259
 
248
- `controld_explain_domain` walks your configuration; it does not resolve DNS. Control D has not formally documented its precedence rules, so the tool reports what it matched in a plausible order and says outright which sections it could not evaluate. Treat it as a research aid, not an authoritative answer.
260
+ `controld_explain_domain` walks your configuration; it does not resolve DNS. It lists matching custom rules in Control D's [documented matching order](https://docs.controld.com/docs/advanced-rules-creation-guide), and says outright which sections it could not evaluate: services and filters are listed, not matched against the domain. For the action Control D actually took, use the query logs.
249
261
 
250
262
  `controld_update_organization` covers `PUT /organizations`. Control D documents the fields but no identifier parameter, and does not say how the target organization is chosen. This tool has not been verified against a live organization account. Treat the target as unconfirmed and check what changed afterwards. If that is not acceptable, make the change in the Control D dashboard instead.
251
263
 
@@ -273,7 +285,9 @@ Found a security problem? See [SECURITY.md](SECURITY.md).
273
285
 
274
286
  **A write fails with a permission error.** The token in `CONTROLD_API_TOKEN_WRITE` is read-scoped. The server cannot tell the two apart, so Control D rejects it at request time instead. Create a write token in the dashboard.
275
287
 
276
- **Organization tools return an error.** Personal accounts have no organization. Those endpoints only work on org accounts.
288
+ **Organization tools return an error.** Personal accounts have no organization. Those endpoints only work on org accounts, and on a personal account they fail with a 404 (code 40401).
289
+
290
+ **`This token does not have access to this endpoint (HTTP 403, code 40301)`.** Control D sends this for a path that does not exist, too, not only for a token without access. If you called `controld_request_read` or `controld_request_write`, check the path first. The same token still works for any path that exists.
277
291
 
278
292
  ## Development
279
293
 
package/dist/client.js CHANGED
@@ -241,10 +241,15 @@ export function createControlDClient(options = {}) {
241
241
  const message = typeof apiError?.message === "string"
242
242
  ? apiError.message
243
243
  : "Control D API request failed.";
244
- const error = new Error(message);
245
- if (typeof apiError?.code === "string" || typeof apiError?.code === "number") {
246
- error.code = apiError.code;
247
- }
244
+ const code = typeof apiError?.code === "string" || typeof apiError?.code === "number"
245
+ ? apiError.code
246
+ : undefined;
247
+ // Status and code in the text: Control D answers an unknown path with
248
+ // 403 / 40301 "no access", which reads like a token problem without them.
249
+ const detail = code === undefined ? `HTTP ${response.status}` : `HTTP ${response.status}, code ${code}`;
250
+ const error = new Error(`${message} (${detail})`);
251
+ if (code !== undefined)
252
+ error.code = code;
248
253
  throw error;
249
254
  }
250
255
  if (!response.ok)
package/dist/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { createControlDClient, resolveConfig } from "./client.js";
5
- import { registerTools } from "./tools.js";
2
+ import { createRequire } from "node:module";
3
+ import { fileURLToPath } from "node:url";
4
+ import { McpServer } from "@modelcontextprotocol/server";
5
+ import { loadSkills } from "@modelcontextprotocol/server/ext/skills/node";
6
+ import { serveStdio } from "@modelcontextprotocol/server/stdio";
7
+ import { createControlDClient, redact, resolveConfig } from "./client.js";
8
+ import { INSTRUCTIONS, registerTools } from "./tools.js";
9
+ // package.json ships in the npm tarball, so `npm version` is the only place to bump.
10
+ const { version } = createRequire(import.meta.url)("../package.json");
6
11
  let config;
7
12
  let client;
8
13
  try {
@@ -14,6 +19,21 @@ catch (error) {
14
19
  console.error(error instanceof Error ? error.message : String(error));
15
20
  process.exit(1);
16
21
  }
17
- const server = new McpServer({ name: "mcp-controld", version: "0.1.0" });
18
- registerTools(server, client, config.writeToken !== undefined);
19
- await server.connect(new StdioServerTransport());
22
+ const skills = await loadSkills(fileURLToPath(new URL("../skills", import.meta.url)), {
23
+ onWarning: (warning) => console.error(`mcp-controld skill ${warning.path}: ${warning.message}`),
24
+ }).catch((error) => {
25
+ console.error(`mcp-controld: skills not served: ${error instanceof Error ? error.message : String(error)}`);
26
+ return undefined;
27
+ });
28
+ // serveStdio may build more than one server per process (a probe it throws
29
+ // away, then the real one), so keep state at module level, not on the server.
30
+ function buildServer() {
31
+ const server = new McpServer({ name: "mcp-controld", version }, { instructions: INSTRUCTIONS });
32
+ registerTools(server, client, config.writeToken !== undefined);
33
+ skills?.attach(server);
34
+ return server;
35
+ }
36
+ // Serves protocol 2026-07-28 and the 2024-10-07 to 2025-11-25 revisions.
37
+ serveStdio(buildServer, {
38
+ onerror: (error) => console.error(`mcp-controld transport error: ${redact(error.message, [config.readToken, config.writeToken])}`),
39
+ });
@@ -30,7 +30,7 @@ export const diagnosticsTools = [
30
30
  defineTool({
31
31
  name: "controld_export_dns_query_logs",
32
32
  config: {
33
- description: "Experimental: export DNS query logs as CSV. Requires Full Analytics on the device and may require an organization account.",
33
+ description: "Export DNS query logs as CSV for a bounded time window. Requires Full Analytics on the device. Works on personal and organization accounts.",
34
34
  inputSchema: z.object({
35
35
  analytics_endpoint_id: analyticsEndpointId.optional().describe("Analytics instance endpoint ID, not a hostname or URL. Omitted: auto-discovered from the account's stats_endpoint."),
36
36
  start_time: rfc3339.describe("RFC 3339 start timestamp."),
@@ -69,7 +69,7 @@ export const diagnosticsTools = [
69
69
  defineTool({
70
70
  name: "controld_explain_domain",
71
71
  config: {
72
- description: "Explain profile configuration relevant to a domain. This is a heuristic config walk, not a DNS resolution trace; Control D precedence is not formally documented.",
72
+ description: "Explain profile configuration relevant to a domain. This is a config walk, not a DNS resolution trace: enabled services and filters are listed, not matched against the domain. For the action Control D actually took, export the DNS query logs.",
73
73
  inputSchema: z.object({
74
74
  profile_id: nonEmptyString.describe("Profile ID."),
75
75
  domain: z.string().trim().min(1).describe("Domain to inspect."),
@@ -128,7 +128,7 @@ export const diagnosticsTools = [
128
128
  return {
129
129
  domain: inspectedDomain,
130
130
  scope: "Configuration walk only; this is not a DNS resolution trace.",
131
- precedence_notice: "Findings are listed in a plausible custom-rule, service-rule, filter, default-rule order; Control D precedence is not formally documented.",
131
+ precedence_notice: "Findings follow Control D's documented matching order: custom rules, service rules, filters, then the default rule. Among custom rules, plain domain rules beat wildcard rules and the most specific domain wins; this walk lists matches without picking the winner. See https://docs.controld.com/docs/advanced-rules-creation-guide.",
132
132
  folder_walk: {
133
133
  limit: MAX_RULE_FOLDERS,
134
134
  discovered: groups.length + 1,
@@ -22,22 +22,21 @@ const profileConfigInput = z.object({
22
22
  folder_id: nonEmptyString.optional().describe("Rule folder ID. Used only when section is rules; omit or pass 0 for the root folder."),
23
23
  ...subOrgInput,
24
24
  }).strict();
25
- const catalogInput = z.discriminatedUnion("catalog", [
26
- z.object({
27
- catalog: z.literal("services"),
28
- category: nonEmptyString,
29
- }).strict(),
30
- z.object({
31
- catalog: z.enum([
32
- "profile_options",
33
- "device_types",
34
- "service_categories",
35
- "proxies",
36
- "analytics_levels",
37
- "analytics_regions",
38
- ]),
39
- }).strict(),
40
- ]);
25
+ // One flat object, not a union: a top-level oneOf leaves hosts and models with
26
+ // no `properties` to read. The refine keeps the union's rules.
27
+ const catalogInput = z.object({
28
+ catalog: z.enum([
29
+ "profile_options",
30
+ "device_types",
31
+ "service_categories",
32
+ "services",
33
+ "proxies",
34
+ "analytics_levels",
35
+ "analytics_regions",
36
+ ]).describe("Catalog to list. 'services' also needs category."),
37
+ category: nonEmptyString.optional()
38
+ .describe("Service category ID from the service_categories catalog. Required with catalog 'services', not allowed otherwise."),
39
+ }).strict().refine((input) => (input.catalog === "services") === (input.category !== undefined), { message: "category is required with catalog 'services' and not allowed with any other catalog.", path: ["category"] });
41
40
  export const readTools = [
42
41
  defineTool({
43
42
  name: "controld_list_profiles",
@@ -84,7 +83,7 @@ export const readTools = [
84
83
  },
85
84
  handler: (client, input) => {
86
85
  const path = input.catalog === "services"
87
- ? `/services/categories/${segment(input.category)}`
86
+ ? `/services/categories/${segment(input.category ?? "")}`
88
87
  : {
89
88
  profile_options: "/profiles/options",
90
89
  device_types: "/devices/types",
@@ -186,6 +186,7 @@ export const writeTools = [
186
186
  via: nonEmptyString.optional(),
187
187
  via_v6: nonEmptyString.optional(),
188
188
  folder_id: z.union([nonEmptyString, integer.min(0)]).optional(),
189
+ comment: z.string().max(64).optional().describe("Optional rule comment, up to 64 characters."),
189
190
  ...subOrgInput,
190
191
  }).strict(),
191
192
  annotations: writeAnnotations,
@@ -208,6 +209,7 @@ export const writeTools = [
208
209
  via: nonEmptyString.optional(),
209
210
  via_v6: nonEmptyString.optional(),
210
211
  folder_id: z.union([nonEmptyString, integer.min(0)]).optional(),
212
+ comment: z.string().max(64).optional().describe("Optional rule comment, up to 64 characters. An empty string clears the existing comment."),
211
213
  ...subOrgInput,
212
214
  }).strict(),
213
215
  annotations: writeAnnotations,
package/dist/tools.js CHANGED
@@ -3,6 +3,15 @@ import { diagnosticsTools } from "./tools-diagnostics.js";
3
3
  import { readTools } from "./tools-read.js";
4
4
  import { writeTools } from "./tools-write.js";
5
5
  import { textResult } from "./tools-shared.js";
6
+ /** Sent to the client on connect. Keep every claim here true to the code below. */
7
+ export const INSTRUCTIONS = [
8
+ "Control D DNS management. Start with controld_list_profiles, then controld_get_profile_config with section \"all\" for one profile.",
9
+ "Every tool with readOnlyHint true only reads. Write tools exist only when the server has a write credential.",
10
+ "A failed call returns isError true and a short plain-text message. Control D failures end with the HTTP status and Control D code, for example \"(HTTP 404, code 40401)\".",
11
+ "HTTP 403 code 40301 \"This token does not have access to this endpoint\" can also mean the path does not exist. Check the path before you blame the token.",
12
+ "Organization tools fail on a personal account. That is expected, not a token problem.",
13
+ "controld_request_read and controld_request_write are escape hatches for undocumented paths. Use a named tool first.",
14
+ ].join("\n");
6
15
  function registerTool(server, client, tool) {
7
16
  server.registerTool(tool.name, tool.config, async (args) => {
8
17
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-controld",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "MCP server for the Control D API. Manage DNS profiles, filters, rules, and devices from any MCP client.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -28,7 +28,8 @@
28
28
  "mcp-controld": "dist/index.js"
29
29
  },
30
30
  "files": [
31
- "dist"
31
+ "dist",
32
+ "skills"
32
33
  ],
33
34
  "engines": {
34
35
  "node": ">=22"
@@ -40,12 +41,13 @@
40
41
  "test": "tsx --test"
41
42
  },
42
43
  "dependencies": {
43
- "@modelcontextprotocol/sdk": "^1.30.0",
44
- "zod": "^4.4.3"
44
+ "@modelcontextprotocol/server": "^2.4.0",
45
+ "zod": "^4.6.7"
45
46
  },
46
47
  "devDependencies": {
47
- "@types/node": "^22.20.1",
48
- "tsx": "^4.23.12",
48
+ "@modelcontextprotocol/client": "^2.4.0",
49
+ "@types/node": "^22.20.7",
50
+ "tsx": "^4.23.15",
49
51
  "typescript": "^7.0.2"
50
52
  }
51
53
  }
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: controld-mcp
3
+ description: Use when a task calls the controld_* tools or touches Control D DNS filtering - a blocked, broken or redirected site, custom rules and rule folders, services, filters, the default rule, profile options, profiles, devices and resolvers, DNS query logs, or sub-organizations. Also use before any Control D write, and whenever someone asks why a site does not load on a network or device that uses Control D, even if they never say "Control D".
4
+ ---
5
+
6
+ # Control D MCP
7
+
8
+ The server instructions are a summary of this file.
9
+
10
+ ## Start here
11
+
12
+ 1. `controld_list_profiles`. Each profile's `profile.opt.data` lists the options set on it.
13
+ 2. `controld_list_devices`. A device (endpoint, resolver) shows its main profile in `profile.PK` and its analytics level in `stats`: 0 off, 1 basic, 2 full. Its `PK` is the `device_id` other tools take. A device can enforce a second profile, an organization can add a Global Profile, and an active schedule replaces the device's profiles: find the profiles that apply before you diagnose.
14
+ 3. `controld_get_profile_config` with `section: "all"` reads one profile's filters, external filters, services, folders, default rule, and the rules of one folder: the root folder by default, or the folder whose `PK` you pass as a string in `folder_id`.
15
+ 4. Check the tool list. Tools with `readOnlyHint: true` only read. Write tools exist only when the server has a write credential. Without them, say nothing was changed, keep using the reads, and give the exact call you would make (tool and arguments) so the change can be run once writes are available. Only a person sets tokens.
16
+
17
+ On an organization account, tools that take `sub_org_id` act inside that sub-organization. Organization tools fail on a personal account with `(HTTP 404, code 40401)`. That is expected, not a token problem.
18
+
19
+ ## How Control D picks the action
20
+
21
+ Control D's documented [matching order](https://docs.controld.com/docs/advanced-rules-creation-guide), highest first:
22
+
23
+ 1. Custom rules (enabled and not expired), then geo custom rules.
24
+ 2. Service rules.
25
+ 3. Filters. They only block.
26
+ 4. The default rule, only when nothing above matched.
27
+
28
+ - The category wins, not the action. A custom rule set to Bypass beats a service set to Block. A service set to Bypass beats a filter.
29
+ - A default rule set to Bypass is only the fallback. It overrides nothing.
30
+ - A service rule turned off (`status: 0`) is not Bypass. Filters and the default rule still apply to its domains.
31
+ - A plain rule like `example.com` also covers every subdomain. The most specific plain rule wins, and plain rules beat wildcard rules like `*.example.com`. When only wildcard rules match, the more specific one wins.
32
+ - Several profiles on one device merge before matching, and the order above still holds. When two profiles set the same rule or service, the earlier profile normally supplies the action.
33
+ - Profile options (DNSSEC, DNS attack blocking and others) can still change a query.
34
+
35
+ ## Codes
36
+
37
+ | Field | Values |
38
+ |---|---|
39
+ | Rule `do` (custom, service, folder, default) | 0 Block, 1 Bypass, 2 Spoof, 3 Redirect |
40
+ | `via` | Spoof: an IPv4 address or hostname. Redirect: a proxy identifier from `controld_list_catalog` with `catalog: "proxies"`. Custom and service rules also take `via_v6`, an IPv6 address for Spoof |
41
+ | `status` on rules, folders, filters and options | 1 on, 0 off |
42
+ | Log `action` | -1 request failed, 0 blocked, 1 bypassed, 2 redirected to an IP, 3 redirected to a location |
43
+ | Log `trigger` | `custom`, `service`, `filter`, `default`, `grule` (global rule), `rebind` (rebind protection), or empty |
44
+ | Log `triggerValue` | When present: the custom rule's hostname, the service `PK` or the filter `PK` |
45
+
46
+ ## Recipes
47
+
48
+ **Why is a site blocked, broken or redirected.**
49
+ 1. Find the device and the profiles that apply with `controld_list_devices`.
50
+ 2. The logs show what Control D actually did. Call `controld_export_dns_query_logs` with `start_time` shortly before the failure, optional `end_time`, and the device's `device_id`. Timestamps are RFC 3339 UTC with seconds, such as `2026-11-01T10:00:00Z`, at most one month back. For "the last 30 minutes", read the clock once and set both ends from it, so the window is exactly what was asked. Read the rows whose `question` is the domain or one the site depends on: `action`, `trigger` and `triggerValue` name what decided it. Tell the user the exact window and the hostnames your rows cover: no rows for a hostname proves nothing about it, and rows from another device, even on the same profile, say nothing about this device.
51
+ - A query is logged only if the device had full analytics (`stats: 2`) at that moment, and not if its rule sits in a `Do Not Log` folder or a `Control D Bypass` folder kept it away from Control D. Missing rows prove nothing. Say so and use step 3.
52
+ - For a question about a whole network or account, name every device now below full analytics: its queries are missing from your counts, and so are any device's queries from times its analytics was lower.
53
+ - The result stops at about 1 MB with a `[TRUNCATED: ...]` line, which can cut the last row. Pass `device_id`, then split the time into shorter windows that meet end to start without overlapping. Never de-duplicate rows: identical rows are separate lookups, often in the same second.
54
+ - The tool finds the account's analytics endpoint itself. Pass `analytics_endpoint_id` only when it says it cannot.
55
+ 3. `controld_explain_domain` with the profile lists the custom rules that name the domain or a parent domain, in the root folder and up to 99 others (`folder_walk.truncated` says when more exist), plus the enabled services, filters and default rule. It lists disabled rules too, and `*.example.com` rules when you ask about `example.com`, although such a wildcard does not match the bare domain. It does not find rules on the domain's subdomains or other wildcard forms, and does not check which services or filters contain the domain. It reads configuration, not what happened. Without a log row for the exact hostname, do not tell the user Control D allows it: say which rules name it, and that the enabled services and filters were not checked against it.
56
+
57
+ **Find every rule under a domain.** For a whole site or service (`tiktok.com` and anything below it), read `controld_get_profile_config` with `section: "folders"`, then `section: "rules"` once without `folder_id` for the root and once per folder with its `PK` as a string. Keep rules whose hostname equals the domain or ends in `.` plus the domain. If a result ends with `[TRUNCATED: ...]`, say the list is incomplete. An enabled plain rule on a subdomain whose action is Bypass (its own, or its folder's) beats a block on the parent, a service or a filter.
58
+
59
+ **Block or allow one domain.**
60
+ 1. Look for an existing rule with `controld_explain_domain`, and for rules on its subdomains as above. Rules are keyed by hostname: change an existing one with `controld_update_custom_rules`, which leaves unlisted hostnames alone. Add new ones with `controld_create_custom_rules`.
61
+ 2. Use the narrowest rule that works. Bypass one subdomain rather than turning off a filter or service.
62
+ 3. A folder with an action gives that action to every rule in it, whatever the rule says. Put an exception in the root folder or in a folder whose action matches.
63
+ 4. Optional `comment`, up to 64 characters. On update, an empty string clears it.
64
+ 5. Read again with `controld_explain_domain`. Devices can keep a cached answer for a while; a new log row proves the new action.
65
+
66
+ **Block or allow a whole service.**
67
+ 1. `controld_list_catalog` with `catalog: "service_categories"`, then with `catalog: "services"` and that `category`, to find the service `PK`.
68
+ 2. Find custom rules on the service's main domains as above. Name any enabled Bypass rule you find: it beats the service block for its hostname.
69
+ 3. `controld_set_service_rule` with the profile, the service `PK`, `do: 0` to block or `1` to allow, and `status: 1`. To allow the service but block one of its domains, add a Block custom rule for that domain.
70
+
71
+ **Filters.** `controld_get_profile_config` with `section: "filters"` or `"external_filters"` lists them with `PK` and `status`. `controld_set_filters` switches several native filters at once. Control D does not document whether it also switches external filters.
72
+
73
+ **Profile options.** `controld_list_catalog` with `catalog: "profile_options"` lists them; pass an option's `PK` as `name` to `controld_set_profile_option`.
74
+
75
+ **Default rule.** `controld_set_default_rule`. Block or Redirect applies to every query nothing else matched, so confirm with the user first.
76
+
77
+ **Folders.** A normal folder can hold rules with different actions. An action folder overrides them (see above). Two names are special. Enabled Bypass rules in a folder named exactly `Control D Bypass` go to the local network's DNS instead of Control D on devices running `ctrld`, once it reloads its config (up to an hour). Rules in `Do Not Log` still act but are not logged.
78
+
79
+ **Try a change safely.** `controld_create_profile` with `clone_profile_id` copies a profile. Change the copy, then point one test device at it with `controld_update_device`. Note the device's profiles first so you can switch back. Every client using that device's resolvers gets the copy.
80
+
81
+ **Pause a profile.** `controld_update_profile` with `disable_ttl`, a Unix timestamp until which the profile is off. `0` ends an earlier pause.
82
+
83
+ ## Writes
84
+
85
+ - Read first, change, read again. A fresh read proves the configuration was saved; a new log row proves the DNS effect.
86
+ - Get a clear yes from the user before:
87
+ - `controld_delete_rule_folder`: it deletes every rule in the folder. Read the folder's rules first and tell the user how many.
88
+ - `controld_delete_device`: everything using its resolvers loses DNS.
89
+ - `controld_delete_profile`: Control D only deletes a profile no device uses.
90
+ - `controld_update_organization`: unverified, and it may change a different organization than intended. Read the organization and its sub-organizations again afterwards and check which one changed.
91
+ - A failed write may still have taken effect. Read before trying again.
92
+
93
+ Inputs of the common write tools, so you can name the exact call even when the server lists no write tools (`?` marks optional; every one also takes `sub_org_id?`):
94
+
95
+ | Tool | Inputs |
96
+ |---|---|
97
+ | `controld_create_custom_rules`, `controld_update_custom_rules` | `profile_id`, `hostnames` (list), `do`, `status`, `via?`, `via_v6?`, `folder_id?` (string or number; omit for the root), `comment?` |
98
+ | `controld_delete_custom_rule` | `profile_id`, `hostname` |
99
+ | `controld_set_service_rule` | `profile_id`, `service`, `do`, `status`, `via?`, `via_v6?` |
100
+ | `controld_set_default_rule` | `profile_id`, `do`, `status`, `via?` |
101
+ | `controld_set_filters` | `profile_id`, `filters`: a list of `{filter, status}` |
102
+ | `controld_set_profile_option` | `profile_id`, `name`, `status`, `value?` |
103
+ | `controld_create_rule_folder` / `controld_update_rule_folder` | `profile_id`, `name` / `folder`, `do`, `status`, `via?` (update also `name?`) |
104
+ | `controld_delete_rule_folder` | `profile_id`, `folder` |
105
+ | `controld_create_profile` / `controld_update_profile` | `name`, `clone_profile_id?` / `profile_id`, `name?`, `disable_ttl?` |
106
+ | `controld_update_device` | `device_id`, then only what changes: `profile_id?`, `profile_id2?`, `stats?`, `name?`, `desc?`, `status?`, `client_count?`, `learn_ip?`, `restricted?`, `bump_tls?`, `legacy_ipv4_status?`, `ddns_status?`, `ddns_subdomain?`, `ddns_ext_status?`, `ddns_ext_host?`, `ctrld_custom_config?` |
107
+ - `controld_request_read` and `controld_request_write` are escape hatches for paths no named tool covers. Take the path and fields from the reference listed in https://docs.controld.com/llms.txt (a reference page with `.md` appended shows its schema). Never guess a path. The write hatch checks the path and the body's shape, not the fields the endpoint needs.
108
+
109
+ ## Errors
110
+
111
+ - A failed call returns `isError` with a short message. Control D failures end with `(HTTP <status>, code <code>)`, the code only when Control D sends one, for example `(HTTP 404, code 40401)`.
112
+ - `(HTTP 403, code 40301)`, "This token does not have access to this endpoint", also means the path does not exist. Check the path before you blame the token.
113
+ - `Input validation error` names what to fix in the arguments. An unknown tool name is a protocol error, -32602.
114
+ - Any result over 1 MB ends with a `[TRUNCATED: ...]` line.