Skip to main content
Glama

manage_policy_file

Handle policy files by fetching, updating, or testing ACL access rules on the Tailscale MCP Server using HuJSON format for precise network management.

Instructions

Manage policy files and test ACL access rules

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYesPolicy file operation to perform
policyNoPolicy content (HuJSON format) for update operation
testRequestNoAccess test parameters for test_access operation

Implementation Reference

  • The handler function implementing the core logic for the 'manage_policy_file' tool. Handles 'get' to retrieve the policy file and 'test_access' to test ACL access rules using Tailscale API.
    async function managePolicyFile(
      args: z.infer<typeof PolicyFileSchema>,
      context: ToolContext,
    ): Promise<CallToolResult> {
      try {
        logger.debug("Managing policy file:", args);
    
        switch (args.operation) {
          case "get": {
            const result = await context.api.getPolicyFile();
            if (!result.success) {
              return returnToolError(result.error);
            }
    
            return returnToolSuccess(
              `Policy File (HuJSON format):\n\n${result.data}`,
            );
          }
    
          case "test_access": {
            if (!args.testRequest) {
              return returnToolError(
                "Test request parameters are required for test_access operation",
              );
            }
    
            const { src, dst, proto } = args.testRequest;
            const result = await context.api.testACLAccess(src, dst, proto);
    
            if (!result.success) {
              return returnToolError(result.error);
            }
    
            const testResult = result.data;
            return returnToolSuccess(
              `ACL Access Test Result:
      - Source: ${src}
      - Destination: ${dst}
      - Protocol: ${proto || "any"}
      - Result: ${testResult?.allowed ? "ALLOWED" : "DENIED"}
      - Rule: ${testResult?.rule || "No matching rule"}
      - Match: ${testResult?.match || "N/A"}`,
            );
          }
    
          default:
            return returnToolError(
              "Invalid policy operation. Use: get or test_access",
            );
        }
      } catch (error) {
        logger.error("Error managing policy file:", error);
        return returnToolError(error);
      }
    }
  • Zod input schema defining parameters for the manage_policy_file tool, including operation types and optional policy content or test request.
    const PolicyFileSchema = z.object({
      operation: z
        .enum(["get", "update", "test_access"])
        .describe("Policy file operation to perform"),
      policy: z
        .string()
        .optional()
        .describe("Policy content (HuJSON format) for update operation"),
      testRequest: z
        .object({
          src: z.string(),
          dst: z.string(),
          proto: z.string().optional(),
        })
        .optional()
        .describe("Access test parameters for test_access operation"),
    });
  • Tool registration within the aclTools module's tools array, linking name, description, schema, and handler.
    {
      name: "manage_policy_file",
      description: "Manage policy files and test ACL access rules",
      inputSchema: PolicyFileSchema,
      handler: managePolicyFile,
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'manage' and 'test' operations but doesn't specify permissions required, whether updates are destructive, rate limits, or what the tool returns. For a tool with multiple operations including updates, this is a significant gap in transparency.

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

Conciseness4/5

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

The description is concise with two clear clauses, though it could be more front-loaded by specifying the three operations upfront. Every word earns its place, but the structure could better highlight the tool's multi-operation nature.

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

Completeness2/5

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

Given the tool's complexity (multiple operations including updates), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what happens during operations, return values, or error conditions, leaving significant gaps for the agent to understand tool behavior.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value by hinting at policy content format (HuJSON) and access testing, but doesn't provide additional semantics beyond what's in the schema. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the tool's purpose as managing policy files and testing ACL access rules, which is specific (verb+resource). However, it doesn't distinguish this from the sibling 'manage_acl' tool, which appears to handle similar ACL-related functionality, preventing a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'manage_acl' or other sibling tools. It lacks context about prerequisites, exclusions, or specific scenarios where this tool is appropriate, leaving the agent with minimal usage direction.

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

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/HexSleeves/tailscale-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server