opnsense_diag_fw_logs
Fetch the latest firewall log entries to analyze traffic and troubleshoot network issues. Specify the number of logs to return.
Instructions
Retrieve recent firewall log entries
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "opnsense_diag_fw_logs"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of log entries to retrieve (default: 50, max: 5000) |
Implementation Reference
- src/tools/diagnostics.ts:396-402 (handler)The handler for opnsense_diag_fw_logs. Parses args with FwLogsSchema (which validates limit as coerced number), makes a GET request to /diagnostics/firewall/log?limit=<limit>, and returns the result as JSON.
case "opnsense_diag_fw_logs": { const parsed = FwLogsSchema.parse(args); const result = await client.get( `/diagnostics/firewall/log?limit=${parsed.limit}`, ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - src/tools/diagnostics.ts:29-31 (schema)FwLogsSchema: Zod schema for opnsense_diag_fw_logs input. Validates 'limit' as a coerced number (int, 1-5000, default 50).
const FwLogsSchema = z.object({ limit: z.coerce.number().int().min(1).max(5000).optional().default(50), }); - src/tools/diagnostics.ts:127-138 (registration)Tool definition for 'opnsense_diag_fw_logs' in diagnosticsToolDefinitions array. Includes name, description, and inputSchema (limit param).
name: "opnsense_diag_fw_logs", description: "Retrieve recent firewall log entries", inputSchema: { type: "object" as const, properties: { limit: { type: "number", description: "Number of log entries to retrieve (default: 50, max: 5000)", }, }, }, }, - src/index.ts:28-28 (registration)Import of diagnosticsToolDefinitions and handleDiagnosticsTool from diagnostics module.
import { diagnosticsToolDefinitions, handleDiagnosticsTool } from './tools/diagnostics.js'; - src/index.ts:61-61 (registration)Registration: iterates diagnosticsToolDefinitions and maps each tool name (including opnsense_diag_fw_logs) to handleDiagnosticsTool in the toolHandlers Map.
for (const def of diagnosticsToolDefinitions) toolHandlers.set(def.name, handleDiagnosticsTool);