[
  {
    "name": "tailnet_status",
    "title": "Tailnet status",
    "description": "Report the state of the local tailnet: this node plus all peers with hostname, MagicDNS name, Tailscale IPv4/IPv6, OS, online flag, last seen, exit-node flags, and tags. Returns a structured error with the exact fix command when the tailscale binary is missing, the daemon is stopped, or the device needs login.",
    "inputSchema": {
      "type": "object",
      "properties": {
        "onlineOnly": {
          "description": "Only include peers that are currently online (default: false)",
          "type": "boolean"
        }
      },
      "$schema": "http://json-schema.org/draft-07/schema#"
    },
    "outputSchema": {
      "type": "object",
      "properties": {
        "backendState": {
          "type": "string"
        },
        "tailnet": {
          "type": "string"
        },
        "magicDNSSuffix": {
          "type": "string"
        },
        "health": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "self": {
          "type": "object",
          "properties": {
            "hostname": {
              "type": "string"
            },
            "dnsName": {
              "type": "string"
            },
            "ipv4": {
              "type": [
                "string",
                "null"
              ]
            },
            "ipv6": {
              "type": [
                "string",
                "null"
              ]
            },
            "os": {
              "type": "string"
            },
            "online": {
              "type": "boolean"
            },
            "lastSeen": {
              "type": [
                "string",
                "null"
              ]
            },
            "exitNode": {
              "type": "boolean"
            },
            "exitNodeOption": {
              "type": "boolean"
            },
            "tags": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sharee": {
              "type": "boolean"
            }
          },
          "required": [
            "hostname",
            "dnsName",
            "ipv4",
            "ipv6",
            "os",
            "online",
            "lastSeen",
            "exitNode",
            "exitNodeOption",
            "tags",
            "sharee"
          ],
          "additionalProperties": false
        },
        "peerCount": {
          "type": "number",
          "description": "Total peers, before any onlineOnly filter"
        },
        "peers": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "hostname": {
                "type": "string"
              },
              "dnsName": {
                "type": "string"
              },
              "ipv4": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ipv6": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "os": {
                "type": "string"
              },
              "online": {
                "type": "boolean"
              },
              "lastSeen": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "exitNode": {
                "type": "boolean"
              },
              "exitNodeOption": {
                "type": "boolean"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "sharee": {
                "type": "boolean"
              }
            },
            "required": [
              "hostname",
              "dnsName",
              "ipv4",
              "ipv6",
              "os",
              "online",
              "lastSeen",
              "exitNode",
              "exitNodeOption",
              "tags",
              "sharee"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "backendState",
        "tailnet",
        "magicDNSSuffix",
        "health",
        "self",
        "peerCount",
        "peers"
      ],
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false
    },
    "annotations": {
      "readOnlyHint": true,
      "destructiveHint": false,
      "idempotentHint": true,
      "openWorldHint": false
    },
    "execution": {
      "taskSupport": "forbidden"
    }
  },
  {
    "name": "generate_ssh_config",
    "title": "Generate SSH config",
    "description": "Generate ssh-config Host blocks for tailnet nodes (MagicDNS name preferred, Tailscale IP fallback). Dry-run by default: returns the generated config text only and writes nothing. With write=true it writes a dedicated file (~/.ssh/tailscale_dev_config) and returns instructions for adding an Include line to ~/.ssh/config (never applied automatically). Direct editing of ~/.ssh/config itself additionally requires target=\"user_ssh_config\" and is idempotent between managed markers, never touching content outside them.",
    "inputSchema": {
      "type": "object",
      "properties": {
        "write": {
          "description": "Actually write the config (default: false = dry-run, text only)",
          "type": "boolean"
        },
        "target": {
          "description": "Write target: \"dedicated_file\" (default, ~/.ssh/tailscale_dev_config) or \"user_ssh_config\" (edit ~/.ssh/config between managed markers)",
          "type": "string",
          "enum": [
            "dedicated_file",
            "user_ssh_config"
          ]
        },
        "onlineOnly": {
          "description": "Only include peers that are currently online (default: false)",
          "type": "boolean"
        },
        "includeShared": {
          "description": "Include nodes of users this node is shared with (default: false). Mullvad exit nodes are always skipped.",
          "type": "boolean"
        },
        "user": {
          "description": "Remote user to set on every Host block",
          "type": "string"
        }
      },
      "$schema": "http://json-schema.org/draft-07/schema#"
    },
    "outputSchema": {
      "type": "object",
      "properties": {
        "dryRun": {
          "type": "boolean"
        },
        "hostCount": {
          "type": "number"
        },
        "skipped": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "hostname": {
                "type": "string"
              },
              "dnsName": {
                "type": "string"
              },
              "reason": {
                "type": "string",
                "enum": [
                  "no_address",
                  "mullvad_exit_node",
                  "shared_node"
                ]
              }
            },
            "required": [
              "hostname",
              "dnsName",
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "renamed": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              },
              "hostname": {
                "type": "string"
              }
            },
            "required": [
              "from",
              "to",
              "hostname"
            ],
            "additionalProperties": false
          }
        },
        "configText": {
          "description": "Generated config (dry run)",
          "type": "string"
        },
        "wrote": {
          "description": "File written; null when nothing changed",
          "type": [
            "string",
            "null"
          ]
        },
        "backup": {
          "type": [
            "string",
            "null"
          ]
        },
        "instructions": {
          "type": "string"
        },
        "note": {
          "type": "string"
        }
      },
      "required": [
        "dryRun",
        "hostCount"
      ],
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false
    },
    "annotations": {
      "readOnlyHint": false,
      "destructiveHint": false,
      "idempotentHint": true,
      "openWorldHint": false
    },
    "execution": {
      "taskSupport": "forbidden"
    }
  },
  {
    "name": "share_status",
    "title": "Share status",
    "description": "Report the active Tailscale Serve/Funnel sessions on this node: one entry per endpoint with its URL, serve port, mount path, proxied target, and a public flag that is true when Funnel exposes it to the open internet. publicExposure is true when anything is public.",
    "inputSchema": {
      "type": "object",
      "properties": {},
      "$schema": "http://json-schema.org/draft-07/schema#"
    },
    "outputSchema": {
      "type": "object",
      "properties": {
        "active": {
          "type": "boolean"
        },
        "publicExposure": {
          "description": "True when any endpoint is exposed via Funnel; null if unknown (old CLI)",
          "type": [
            "boolean",
            "null"
          ]
        },
        "endpoints": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "host": {
                "type": "string"
              },
              "httpsPort": {
                "type": "number"
              },
              "scheme": {
                "type": "string",
                "enum": [
                  "https",
                  "http"
                ]
              },
              "path": {
                "type": "string"
              },
              "target": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "targetType": {
                "type": "string",
                "enum": [
                  "proxy",
                  "path",
                  "text",
                  "redirect",
                  "unknown"
                ]
              },
              "public": {
                "type": "boolean"
              },
              "foreground": {
                "type": "boolean"
              }
            },
            "required": [
              "url",
              "host",
              "httpsPort",
              "scheme",
              "path",
              "target",
              "targetType",
              "public",
              "foreground"
            ],
            "additionalProperties": false
          }
        },
        "tcpForwards": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "port": {
                "type": "number"
              },
              "target": {
                "type": "string"
              },
              "public": {
                "type": "boolean"
              },
              "foreground": {
                "type": "boolean"
              }
            },
            "required": [
              "port",
              "target",
              "public",
              "foreground"
            ],
            "additionalProperties": false
          }
        },
        "status": {
          "description": "Raw text status, only on CLIs without --json",
          "type": "string"
        }
      },
      "required": [
        "active",
        "publicExposure",
        "endpoints"
      ],
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false
    },
    "annotations": {
      "readOnlyHint": true,
      "destructiveHint": false,
      "idempotentHint": true,
      "openWorldHint": false
    },
    "execution": {
      "taskSupport": "forbidden"
    }
  },
  {
    "name": "share_port",
    "title": "Share a local port",
    "description": "Share a local port over the tailnet via Tailscale Serve (tailnet-only by default). WARNING: setting public=true switches to Funnel and exposes the port to the OPEN INTERNET — anyone with the URL can reach it. Only set public=true when internet exposure is explicitly intended. Funnel is DISABLED on this server: public=true returns FUNNEL_DISABLED unless the user sets TAILSCALE_MCP_ALLOW_FUNNEL=1. Returns the resulting URL(s).",
    "inputSchema": {
      "type": "object",
      "properties": {
        "port": {
          "type": "integer",
          "minimum": 1,
          "maximum": 65535,
          "description": "Local port to share"
        },
        "public": {
          "description": "Expose to the open internet via Funnel (default: false = tailnet-only Serve). DANGEROUS: public=true makes the port reachable by anyone on the internet. Disabled unless TAILSCALE_MCP_ALLOW_FUNNEL=1.",
          "type": "boolean"
        },
        "path": {
          "description": "HTTPS mount path on the serve endpoint, e.g. \"/api\" (default: \"/\")",
          "type": "string",
          "pattern": "^\\/[A-Za-z0-9._~\\-/]*$"
        }
      },
      "required": [
        "port"
      ],
      "$schema": "http://json-schema.org/draft-07/schema#"
    },
    "outputSchema": {
      "type": "object",
      "properties": {
        "port": {
          "type": "number"
        },
        "public": {
          "type": "boolean"
        },
        "scope": {
          "type": "string"
        },
        "urls": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "port",
        "public",
        "scope",
        "urls"
      ],
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false
    },
    "annotations": {
      "readOnlyHint": false,
      "destructiveHint": false,
      "idempotentHint": true,
      "openWorldHint": false
    },
    "execution": {
      "taskSupport": "forbidden"
    }
  },
  {
    "name": "stop_share",
    "title": "Stop sharing",
    "description": "Stop Serve/Funnel shares: one mount, the shares this server created, or all of them, reporting what was removed. Name exactly one target: httpsPort and/or path turns off that one mount (httpsPort is the serve port shown in share_status, typically 443, not the proxied local port; path is the mount path given to share_port, default \"/\"); mine=true stops only the shares this server created in this session; all=true clears the entire serve/funnel configuration, including shares set up outside this server. With no arguments nothing is stopped and the active endpoints are listed. Returns what was removed and what remains.",
    "inputSchema": {
      "type": "object",
      "properties": {
        "httpsPort": {
          "description": "HTTPS serve port of the mount to turn off (default 443 when path is given)",
          "type": "integer",
          "minimum": 1,
          "maximum": 65535
        },
        "path": {
          "description": "Mount path to turn off, as passed to share_port (default: \"/\")",
          "type": "string",
          "pattern": "^\\/[A-Za-z0-9._~\\-/]*$"
        },
        "mine": {
          "description": "Stop only the shares created by share_port in this session",
          "type": "boolean"
        },
        "all": {
          "description": "Clear the ENTIRE serve/funnel config, including shares not created by this server",
          "type": "boolean"
        }
      },
      "$schema": "http://json-schema.org/draft-07/schema#"
    },
    "outputSchema": {
      "type": "object",
      "properties": {
        "stopped": {
          "anyOf": [
            {
              "type": "string",
              "const": "all"
            },
            {
              "type": "object",
              "properties": {
                "httpsPort": {
                  "type": "number"
                },
                "path": {
                  "type": "string"
                }
              },
              "required": [
                "httpsPort",
                "path"
              ],
              "additionalProperties": false
            },
            {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "httpsPort": {
                    "type": "number"
                  },
                  "path": {
                    "type": "string"
                  }
                },
                "required": [
                  "httpsPort",
                  "path"
                ],
                "additionalProperties": false
              }
            }
          ]
        },
        "removed": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "host": {
                "type": "string"
              },
              "httpsPort": {
                "type": "number"
              },
              "scheme": {
                "type": "string",
                "enum": [
                  "https",
                  "http"
                ]
              },
              "path": {
                "type": "string"
              },
              "target": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "targetType": {
                "type": "string",
                "enum": [
                  "proxy",
                  "path",
                  "text",
                  "redirect",
                  "unknown"
                ]
              },
              "public": {
                "type": "boolean"
              },
              "foreground": {
                "type": "boolean"
              }
            },
            "required": [
              "url",
              "host",
              "httpsPort",
              "scheme",
              "path",
              "target",
              "targetType",
              "public",
              "foreground"
            ],
            "additionalProperties": false
          }
        },
        "remaining": {
          "type": "object",
          "properties": {
            "active": {
              "type": "boolean"
            },
            "publicExposure": {
              "description": "True when any endpoint is exposed via Funnel; null if unknown (old CLI)",
              "type": [
                "boolean",
                "null"
              ]
            },
            "endpoints": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "host": {
                    "type": "string"
                  },
                  "httpsPort": {
                    "type": "number"
                  },
                  "scheme": {
                    "type": "string",
                    "enum": [
                      "https",
                      "http"
                    ]
                  },
                  "path": {
                    "type": "string"
                  },
                  "target": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "targetType": {
                    "type": "string",
                    "enum": [
                      "proxy",
                      "path",
                      "text",
                      "redirect",
                      "unknown"
                    ]
                  },
                  "public": {
                    "type": "boolean"
                  },
                  "foreground": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "url",
                  "host",
                  "httpsPort",
                  "scheme",
                  "path",
                  "target",
                  "targetType",
                  "public",
                  "foreground"
                ],
                "additionalProperties": false
              }
            },
            "tcpForwards": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "port": {
                    "type": "number"
                  },
                  "target": {
                    "type": "string"
                  },
                  "public": {
                    "type": "boolean"
                  },
                  "foreground": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "port",
                  "target",
                  "public",
                  "foreground"
                ],
                "additionalProperties": false
              }
            },
            "status": {
              "description": "Raw text status, only on CLIs without --json",
              "type": "string"
            }
          },
          "required": [
            "active",
            "publicExposure",
            "endpoints"
          ],
          "additionalProperties": false
        },
        "failures": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "httpsPort": {
                "type": "number"
              },
              "path": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": [
              "httpsPort",
              "path",
              "error"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "stopped",
        "removed",
        "remaining"
      ],
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false
    },
    "annotations": {
      "readOnlyHint": false,
      "destructiveHint": true,
      "idempotentHint": true,
      "openWorldHint": false
    },
    "execution": {
      "taskSupport": "forbidden"
    }
  },
  {
    "name": "ping_all",
    "title": "Ping all peers",
    "description": "Ping tailnet peers concurrently (bounded to 5 at a time, with a per-ping timeout) and return a latency matrix: node, latency ms of the settled path, path (direct, DERP relay, or peer relay), or unreachable. Defaults to online peers only. The whole call is capped at 45s; peers not answered by then are reported with an error and timedOut is true.",
    "inputSchema": {
      "type": "object",
      "properties": {
        "count": {
          "description": "Ping attempts per peer (default: 1)",
          "type": "integer",
          "minimum": 1,
          "maximum": 10
        },
        "timeoutMs": {
          "description": "Per-ping timeout in milliseconds (default: 5000)",
          "type": "integer",
          "minimum": 100,
          "maximum": 60000
        },
        "onlineOnly": {
          "description": "Only ping peers reported online (default: true)",
          "type": "boolean"
        }
      },
      "$schema": "http://json-schema.org/draft-07/schema#"
    },
    "outputSchema": {
      "type": "object",
      "properties": {
        "pinged": {
          "type": "number"
        },
        "reachable": {
          "type": "number"
        },
        "timedOut": {
          "type": "boolean"
        },
        "matrix": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "hostname": {
                "type": "string"
              },
              "dnsName": {
                "type": "string"
              },
              "target": {
                "type": "string"
              },
              "reachable": {
                "type": "boolean"
              },
              "latencyMs": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "path": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "direct",
                      "derp",
                      "peer-relay",
                      "unknown"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "via": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "attempts": {
                "type": "number"
              },
              "replies": {
                "type": "number"
              },
              "error": {
                "type": "string"
              }
            },
            "required": [
              "hostname",
              "dnsName",
              "target",
              "reachable",
              "latencyMs",
              "path",
              "via",
              "attempts",
              "replies"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "pinged",
        "reachable",
        "timedOut",
        "matrix"
      ],
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false
    },
    "annotations": {
      "readOnlyHint": true,
      "destructiveHint": false,
      "idempotentHint": true,
      "openWorldHint": false
    },
    "execution": {
      "taskSupport": "forbidden"
    }
  }
]
