@@ -3,6 +3,7 @@ package tools
33import (
44 "context"
55 _ "embed"
6+ "html/template"
67 "log/slog"
78 "net/http"
89 "time"
@@ -10,8 +11,13 @@ import (
1011 "charm.land/fantasy"
1112)
1213
13−//go:embed web_search.md
14−var webSearchToolDescription string
14+//go:embed web_search.md.tpl
15+var webSearchDescriptionTmpl []byte
16+
17+var webSearchDescriptionTpl = template.Must(
18+ template.New("webSearchDescription").
19+ Parse(string(webSearchDescriptionTmpl)),
20+)
1521
1622// NewWebSearchTool creates a web search tool for sub-agents (no permissions needed).
1723func NewWebSearchTool(client *http.Client) fantasy.AgentTool {
@@ -29,7 +35,7 @@ func NewWebSearchTool(client *http.Client) fantasy.AgentTool {
2935
3036 return fantasy.NewParallelAgentTool(
3137 WebSearchToolName,
32− webSearchToolDescription,
38+ renderToolDescription(webSearchDescriptionTpl),
3339 func(ctx context.Context, params WebSearchParams, call fantasy.ToolCall) (fantasy.ToolResponse, error) {
3440 if params.Query == "" {
3541 return fantasy.NewTextErrorResponse("query is required"), nil