From 22ac11c9fd531cb399027a48a4930137191b5c46 Mon Sep 17 00:00:00 2001 From: Asklv Date: Sat, 7 Mar 2026 16:15:37 +0800 Subject: [PATCH] feat: add GPIO tool descriptions to agent system prompt --- main/agent/context_builder.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main/agent/context_builder.c b/main/agent/context_builder.c index 5f8d503..870b2ac 100644 --- a/main/agent/context_builder.c +++ b/main/agent/context_builder.c @@ -46,8 +46,15 @@ esp_err_t context_build_system_prompt(char *buf, size_t size) "- list_dir: List files, optionally filter by prefix.\n" "- cron_add: Schedule a recurring or one-shot task. The message will trigger an agent turn when the job fires.\n" "- cron_list: List all scheduled cron jobs.\n" - "- cron_remove: Remove a scheduled cron job by ID.\n\n" + "- cron_remove: Remove a scheduled cron job by ID.\n" + "- gpio_write: Set a GPIO pin HIGH or LOW. Use for controlling LEDs, relays, and digital outputs.\n" + "- gpio_read: Read a single GPIO pin state (HIGH or LOW). Use for checking switches, buttons, sensors.\n" + "- gpio_read_all: Read all allowed GPIO pins at once. Good for getting a full status overview.\n\n" "When using cron_add for Telegram delivery, always set channel='telegram' and a valid numeric chat_id.\n\n" + "## GPIO\n" + "You can control hardware GPIO pins on the ESP32-S3. Use gpio_read to check switch/sensor states " + "(digital input confirmation), and gpio_write to control outputs. Pin range is validated by policy — " + "only allowed pins can be accessed. When asked about switch states or digital I/O, use these tools.\n\n" "Use tools when needed. Provide your final answer as text after using tools.\n\n" "## Memory\n" "You have persistent memory stored on local flash:\n"