opnsense_nat_source_get
Retrieve a specific OPNsense Source NAT rule by UUID. Returns full configuration details for read-only access.
Instructions
Get a single Source NAT rule by UUID with full configuration. Read-only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes | Source NAT rule UUID |
Implementation Reference
- src/tools/nat.ts:221-227 (handler)Handler for opnsense_nat_source_get: parses the UUID from args, then calls client.get() on the OPNsense firewall/source_nat/get_rule/{uuid} API endpoint, returning the full rule configuration as JSON.
case "opnsense_nat_source_get": { const uuid = z.object({ uuid: UuidSchema }).parse(args).uuid; const result = await client.get( `/firewall/source_nat/get_rule/${encodeURIComponent(uuid)}`, ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - src/utils/validation.ts:3-5 (schema)UuidSchema is imported and used to validate that the 'uuid' argument is a valid UUID string.
export const UuidSchema = z .string() .uuid("Invalid UUID format"); - src/tools/nat.ts:97-106 (registration)Registration entry defining the 'opnsense_nat_source_get' tool with its name, description, and input schema (requires a uuid string).
{ name: "opnsense_nat_source_get", description: "Get a single Source NAT rule by UUID with full configuration. Read-only.", inputSchema: { type: "object" as const, properties: { uuid: { type: "string", description: "Source NAT rule UUID" }, }, required: ["uuid"], }, - src/index.ts:70-70 (registration)Maps the tool name 'opnsense_nat_source_get' (and all other NAT tools) to the handleNatTool handler function in the MCP server.
for (const def of natToolDefinitions) toolHandlers.set(def.name, handleNatTool); - src/index.ts:51-51 (registration)natToolDefinitions (which includes opnsense_nat_source_get) is spread into allToolDefinitions so it's exposed via the MCP ListTools endpoint.
...natToolDefinitions,