opnsense_route_list
List all configured static routes on OPNsense firewall to inspect and manage network routing settings.
Instructions
List all configured static routes
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_route_list"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/routing.ts:195-198 (handler)Handler for opnsense_route_list: calls client.get('/routes/routes/searchroute') and returns the result as JSON. This is the core execution logic.
case "opnsense_route_list": { const result = await client.get("/routes/routes/searchroute"); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - src/tools/routing.ts:78-82 (registration)Tool definition registration for opnsense_route_list: defines the tool name, description, and empty input schema (no parameters required).
export const routingToolDefinitions = [ { name: "opnsense_route_list", description: "List all configured static routes", inputSchema: { type: "object" as const, properties: {} }, - src/index.ts:67-67 (registration)Maps the tool name 'opnsense_route_list' to handleRoutingTool in the central tool handler registry.
for (const def of routingToolDefinitions) toolHandlers.set(def.name, handleRoutingTool); - src/client/opnsense-client.ts:28-83 (helper)The OPNsenseClient.get() method used by the handler to make the API GET request to /routes/routes/searchroute.
async get<T>(path: string): Promise<T> { try { const response = await this.http.get<T>(path); return response.data; } catch (error: unknown) { throw extractError(error, `GET ${path}`); } } async getRaw(path: string): Promise<string> { try { const response = await this.http.get<string>(path, { responseType: "text", headers: { Accept: "application/xml" }, }); return response.data; } catch (error: unknown) { throw extractError(error, `GET ${path} (raw)`); } } async post<T>(path: string, data?: unknown): Promise<T> { try { const response = await this.http.post<T>(path, data ?? {}, { headers: { "Content-Type": "application/json" }, }); return response.data; } catch (error: unknown) { throw extractError(error, `POST ${path}`); } } async delete<T>(path: string): Promise<T> { try { const response = await this.http.delete<T>(path); return response.data; } catch (error: unknown) { throw extractError(error, `DELETE ${path}`); } } static fromEnv(): OPNsenseClient { const url = process.env["OPNSENSE_URL"]; const apiKey = process.env["OPNSENSE_API_KEY"]; const apiSecret = process.env["OPNSENSE_API_SECRET"]; if (!url) throw new Error("OPNSENSE_URL environment variable is required"); if (!apiKey) throw new Error("OPNSENSE_API_KEY environment variable is required"); if (!apiSecret) throw new Error("OPNSENSE_API_SECRET environment variable is required"); const verifySsl = process.env["OPNSENSE_VERIFY_SSL"] !== "false"; const timeout = parseInt(process.env["OPNSENSE_TIMEOUT"] ?? "30000", 10); return new OPNsenseClient({ url, apiKey, apiSecret, verifySsl, timeout }); } }