Skip to content

Commit fdb1ebb

Browse files
Add support for tools, add new tools, add mcp support (#466)
* web_fetch tool: convert html to markdown * Fixes, tests * Add write_file tool * fix: guard MCP config errors, confirm write_file overwrites, and fix exec timeout/confirmation handling Co-authored-by: Andrew <66430340+aandrew-me@users.noreply.github.com> * Mcp fixes * Proxy support for mcp, tool changes * fix: mark cancelled tool calls with failure indicator instead of success Co-authored-by: Andrew <66430340+aandrew-me@users.noreply.github.com> * MCP headers, updated docs * Add interactive mode to add mcp server * fix: restrict MCP config file permissions and avoid overwrite on parse error Co-authored-by: Andrew <66430340+aandrew-me@users.noreply.github.com> * Don't stop when tool call reaches its limit * fix: prevent depth-limit follow-up from re-entering tool-call branch Co-authored-by: Andrew <66430340+aandrew-me@users.noreply.github.com> * Add support to select local tools to use * Add firecrawl web search tool * fix: validate --tools names and cap firecrawl search output length Co-authored-by: Andrew <66430340+aandrew-me@users.noreply.github.com> * Tool call status formatting fixes * fix: truncate search results on rune boundaries to avoid splitting UTF-8 Co-authored-by: Andrew <66430340+aandrew-me@users.noreply.github.com> * Add mcp remove interactive menu --------- Co-authored-by: Gitar <noreply@gitar.ai>
1 parent 4fb749a commit fdb1ebb

26 files changed

Lines changed: 2758 additions & 201 deletions

File tree

$null

Whitespace-only changes.

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ CLAUDE.md
77
.mcp.json
88
.claude
99

10-
# Tools directory - development/testing utilities
11-
tools/
1210
.opencode/
1311
config.conf
1412
config.txt
15-
*.jpg
13+
*.jpg
14+
mcp_config.json

go.mod

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module github.com/aandrew-me/tgpt/v2
22

3-
go 1.25.0
3+
go 1.25.5
44

55
require (
6+
github.com/JohannesKaufmann/html-to-markdown/v2 v2.5.2
67
github.com/atotto/clipboard v0.1.4
78
github.com/bogdanfinn/fhttp v0.6.8
89
github.com/bogdanfinn/tls-client v1.15.1
@@ -11,12 +12,14 @@ require (
1112
github.com/charmbracelet/bubbletea v1.3.10
1213
github.com/fatih/color v1.19.0
1314
github.com/google/uuid v1.6.0
15+
github.com/mark3labs/mcp-go v0.57.0
1416
github.com/olekukonko/ts v0.0.0-20171002115256-78ecb04241c0
1517
github.com/stretchr/testify v1.11.1
1618
golang.org/x/mod v0.38.0
1719
)
1820

1921
require (
22+
github.com/JohannesKaufmann/dom v0.3.1 // indirect
2023
github.com/bdandy/go-errors v1.2.2 // indirect
2124
github.com/bdandy/go-socks4 v1.2.3 // indirect
2225
github.com/bogdanfinn/quic-go-utls v1.0.9-utls // indirect
@@ -26,8 +29,12 @@ require (
2629
github.com/clipperhouse/displaywidth v0.11.0 // indirect
2730
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
2831
github.com/ebitengine/purego v0.10.1 // indirect
32+
github.com/google/jsonschema-go v0.4.2 // indirect
2933
github.com/quic-go/qpack v0.6.0 // indirect
34+
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
35+
github.com/spf13/cast v1.7.1 // indirect
3036
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
37+
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
3138
golang.design/x/x11 v0.2.0 // indirect
3239
golang.org/x/exp/shiny v0.0.0-20260709172345-9ea1abe57597 // indirect
3340
golang.org/x/image v0.44.0 // indirect

go.sum

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
github.com/JohannesKaufmann/dom v0.3.1 h1:J16l9JAHWgkFPR3VIPbQ1gvS0cWab6laK1q7PFL3qh0=
2+
github.com/JohannesKaufmann/dom v0.3.1/go.mod h1:BZPkf8ZeYrBgABjwJn9iiKt8aiCtkxpHkevms+Yp2DE=
3+
github.com/JohannesKaufmann/html-to-markdown/v2 v2.5.2 h1:XFJZFWESIWlUEHHjzBuv8RvrtCWnSGlimEX17ysSDb8=
4+
github.com/JohannesKaufmann/html-to-markdown/v2 v2.5.2/go.mod h1:BHWO8lJzttJLqwuV8Rb1B3OG2OSzLbssZDI1FRg2eAA=
15
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
26
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
37
github.com/andybalholm/brotli v1.2.2 h1:HzTuoo2ErYQqf5qvcJInB8uvqSVxRttzkFexPWtnceM=
@@ -44,12 +48,20 @@ github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJ
4448
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
4549
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4650
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
51+
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
52+
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
4753
github.com/ebitengine/purego v0.10.1 h1:dewVBCBT2GaMu1SrNTYxQhgQBethzfhiwvZiLGP/qyY=
4854
github.com/ebitengine/purego v0.10.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
4955
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
5056
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
5157
github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w=
5258
github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE=
59+
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
60+
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
61+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
62+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
63+
github.com/google/jsonschema-go v0.4.2 h1:tmrUohrwoLZZS/P3x7ex0WAVknEkBZM46iALbcqoRA8=
64+
github.com/google/jsonschema-go v0.4.2/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
5365
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
5466
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
5567
github.com/klauspost/compress v1.19.0 h1:sXLILfc9jV2QYWkzFOPWStmcUVH2RHEB1JCdY2oVvCQ=
@@ -60,6 +72,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
6072
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
6173
github.com/lucasb-eyer/go-colorful v1.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwW4TvVgFr4=
6274
github.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
75+
github.com/mark3labs/mcp-go v0.57.0 h1:jzWKyCzdWnwnZt05cvcQQ+ngiUl2RnixXJa7Kj4qP1E=
76+
github.com/mark3labs/mcp-go v0.57.0/go.mod h1:+8WclSK1ZUweCP3hvktSji8n8ABG/95QaEkeVE/Uwas=
6377
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
6478
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
6579
github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
@@ -94,8 +108,16 @@ github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
94108
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
95109
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
96110
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
97-
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
98-
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
111+
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
112+
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
113+
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ=
114+
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
115+
github.com/sebdah/goldie/v2 v2.8.0 h1:dZb9wR8q5++oplmEiJT+U/5KyotVD+HNGCAc5gNr8rc=
116+
github.com/sebdah/goldie/v2 v2.8.0/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI=
117+
github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
118+
github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
119+
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
120+
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
99121
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
100122
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
101123
github.com/tam7t/hpkp v0.0.0-20160821193359-2b70b4024ed5 h1:YqAladjX7xpA6BM04leXMWAEjS0mTZ5kUU9KRBriQJc=
@@ -104,6 +126,10 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavM
104126
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
105127
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
106128
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
129+
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
130+
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
131+
github.com/yuin/goldmark v1.8.2 h1:kEGpgqJXdgbkhcOgBxkC0X0PmoPG1ZyoZ117rDVp4zE=
132+
github.com/yuin/goldmark v1.8.2/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
107133
go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko=
108134
go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o=
109135
golang.design/x/clipboard v0.8.0 h1:6VEcH28wwcSgKc+vnxHHDWiRjrakTQIAJnPUrt3aOgg=

main.go

Lines changed: 121 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"bufio"
5+
"context"
56
"encoding/json"
67
"flag"
78
"fmt"
@@ -18,7 +19,9 @@ import (
1819
"github.com/aandrew-me/tgpt/v2/src/bubbletea"
1920
"github.com/aandrew-me/tgpt/v2/src/helper"
2021
"github.com/aandrew-me/tgpt/v2/src/imagegen"
22+
"github.com/aandrew-me/tgpt/v2/src/mcp"
2123
"github.com/aandrew-me/tgpt/v2/src/structs"
24+
"github.com/aandrew-me/tgpt/v2/src/tools"
2225
"github.com/aandrew-me/tgpt/v2/src/utils"
2326
Prompt "github.com/c-bata/go-prompt"
2427
tea "github.com/charmbracelet/bubbletea"
@@ -32,6 +35,44 @@ var blue = color.New(color.FgBlue)
3235

3336
var programLoop = true
3437

38+
type toolsFlagValue struct {
39+
enabled bool
40+
toolNames []string
41+
}
42+
43+
func (f *toolsFlagValue) String() string {
44+
if !f.enabled {
45+
return "false"
46+
}
47+
if len(f.toolNames) == 0 {
48+
return "true"
49+
}
50+
return strings.Join(f.toolNames, ",")
51+
}
52+
53+
func (f *toolsFlagValue) Set(s string) error {
54+
f.enabled = true
55+
if s == "true" || s == "1" || s == "" {
56+
return nil
57+
}
58+
if s == "false" || s == "0" {
59+
f.enabled = false
60+
return nil
61+
}
62+
parts := strings.Split(s, ",")
63+
for _, p := range parts {
64+
p = strings.TrimSpace(p)
65+
if p != "" {
66+
f.toolNames = append(f.toolNames, p)
67+
}
68+
}
69+
return nil
70+
}
71+
72+
func (f *toolsFlagValue) IsBoolFlag() bool {
73+
return true
74+
}
75+
3576
func restoreTerminal() {
3677
if runtime.GOOS != "windows" {
3778
rawModeOff := exec.Command("stty", "-raw", "echo")
@@ -346,11 +387,43 @@ func main() {
346387
isChangelog := flag.Bool("cl", false, "See changelog of versions")
347388
flag.BoolVar(isChangelog, "changelog", false, "See changelog of versions")
348389

390+
mcpConfig := flag.String("mcp-config", os.Getenv("MCP_CONFIG"), "Path to MCP server configuration JSON file")
391+
mcpServer := flag.String("mcp-server", "", "Command to run a stdio MCP server directly")
392+
mcpAdd := flag.Bool("mcp-add", false, "Interactively add a new MCP server to mcp_config.json")
393+
mcpRemove := flag.Bool("mcp-remove", false, "Interactively remove an MCP server from mcp_config.json")
394+
var toolsFlag toolsFlagValue
395+
flag.Var(&toolsFlag, "t", "Enable tools / MCP support")
396+
flag.Var(&toolsFlag, "tools", "Enable tools / MCP support")
397+
349398
isVerbose := flag.Bool("vb", false, "Enable verbose output for debugging")
350399
flag.BoolVar(isVerbose, "verbose", false, "Enable verbose output for debugging")
351400

352401
flag.Parse()
353402

403+
promptArgIndex := 0
404+
if toolsFlag.enabled && len(toolsFlag.toolNames) == 0 && flag.NArg() > 0 {
405+
if parsedTools, ok := tools.ParseToolList(flag.Arg(0)); ok {
406+
toolsFlag.toolNames = parsedTools
407+
promptArgIndex = 1
408+
}
409+
}
410+
411+
if *mcpAdd {
412+
if err := mcp.AddServerInteractive(context.Background(), *mcpConfig); err != nil {
413+
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
414+
os.Exit(1)
415+
}
416+
os.Exit(0)
417+
}
418+
419+
if *mcpRemove {
420+
if err := mcp.RemoveServerInteractive(context.Background(), *mcpConfig); err != nil {
421+
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
422+
os.Exit(1)
423+
}
424+
os.Exit(0)
425+
}
426+
354427
var rotateProvidersSet bool
355428
flag.Visit(func(f *flag.Flag) {
356429
if f.Name == "rotate" {
@@ -380,6 +453,48 @@ func main() {
380453
finalSearchProvider = "exa"
381454
}
382455

456+
var mcpConfigSet bool
457+
flag.Visit(func(f *flag.Flag) {
458+
if f.Name == "mcp-config" {
459+
mcpConfigSet = true
460+
}
461+
})
462+
463+
var activeTools []any
464+
mcpMgr := mcp.NewManager(tools.DefaultRegistry)
465+
defer mcpMgr.Close()
466+
467+
if toolsFlag.enabled {
468+
tools.DefaultRegistry.RegisterBuiltinTools(toolsFlag.toolNames...)
469+
}
470+
471+
if mcpConfigSet || *mcpConfig != "" || *mcpServer != "" {
472+
ctx := context.Background()
473+
cfg, err := mcp.LoadConfig(*mcpConfig)
474+
if err != nil {
475+
fmt.Fprintf(os.Stderr, "Warning: failed to load MCP config: %v\n", err)
476+
} else if cfg != nil {
477+
for name, sc := range cfg.MCPServers {
478+
if err := mcpMgr.InitServer(ctx, name, sc); err != nil {
479+
fmt.Fprintf(os.Stderr, "Warning: failed to init MCP server %s: %v\n", name, err)
480+
}
481+
}
482+
}
483+
if *mcpServer != "" {
484+
parts := strings.Fields(*mcpServer)
485+
if len(parts) > 0 {
486+
sc := mcp.ServerConfig{Command: parts[0], Args: parts[1:]}
487+
if err := mcpMgr.InitServer(ctx, "cli-mcp", sc); err != nil {
488+
fmt.Fprintf(os.Stderr, "Warning: failed to init MCP server %s: %v\n", *mcpServer, err)
489+
}
490+
}
491+
}
492+
}
493+
494+
if toolsFlag.enabled || mcpConfigSet || *mcpConfig != "" || *mcpServer != "" {
495+
activeTools = tools.DefaultRegistry.GetOpenAITools()
496+
}
497+
383498
mainParams := structs.Params{
384499
ApiKey: *apiKey,
385500
ApiModel: *apiModel,
@@ -391,6 +506,7 @@ func main() {
391506
Url: *url,
392507
PrevMessages: []any{},
393508
RotateProviders: rotateStr,
509+
Tools: activeTools,
394510
}
395511

396512
imageParams := structs.ImageParams{
@@ -403,7 +519,7 @@ func main() {
403519
Params: mainParams,
404520
}
405521

406-
prompt := flag.Arg(0)
522+
prompt := flag.Arg(promptArgIndex)
407523

408524
pipedInput := ""
409525
cleanPipedInput := ""
@@ -747,13 +863,13 @@ func main() {
747863
utils.PrintError(`Example: tgpt -q "What is encryption?"`)
748864
return
749865
}
750-
if _, err := helper.MakeRequestAndGetData(*preprompt+trimmedPrompt+contextText+pipedInput, mainParams, structs.ExtraOptions{IsGetSilent: true}); err != nil {
866+
if _, _, err := helper.MakeRequestAndGetData(*preprompt+trimmedPrompt+contextText+pipedInput, mainParams, structs.ExtraOptions{IsGetSilent: true}); err != nil {
751867
return
752868
}
753869
} else {
754870
formattedInput := bubbletea.GetFormattedInputStdin()
755871
fmt.Println()
756-
if _, err := helper.MakeRequestAndGetData(*preprompt+formattedInput+cleanPipedInput, mainParams, structs.ExtraOptions{IsGetSilent: true}); err != nil {
872+
if _, _, err := helper.MakeRequestAndGetData(*preprompt+formattedInput+cleanPipedInput, mainParams, structs.ExtraOptions{IsGetSilent: true}); err != nil {
757873
return
758874
}
759875
}
@@ -770,7 +886,7 @@ func main() {
770886
*preprompt+formattedInput+contextText+pipedInput,
771887
mainParams,
772888
structs.ExtraOptions{
773-
IsNormal: true, IsInteractive: false,
889+
IsNormal: true, IsInteractive: false, Verbose: *isVerbose,
774890
})
775891
}
776892
} else {
@@ -782,7 +898,7 @@ func main() {
782898
}
783899
input := scanner.Text()
784900
formattedInput := strings.TrimSpace(input)
785-
helper.GetData(*preprompt+formattedInput+pipedInput, mainParams, structs.ExtraOptions{IsInteractive: false, IsNormal: true})
901+
helper.GetData(*preprompt+formattedInput+pipedInput, mainParams, structs.ExtraOptions{IsInteractive: false, IsNormal: true, Verbose: *isVerbose})
786902
}
787903
}
788904

0 commit comments

Comments
 (0)