Skip to content

Commit

Permalink
✨ Add debug and tracing flags to start command
Browse files Browse the repository at this point in the history
  • Loading branch information
wesen committed Jan 26, 2025
1 parent 8c11dff commit 8e06d1f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Added Shell Tool Provider Debug Flags

Added command line flags to control ShellToolProvider debugging and tracing:
- Added --debug flag to enable detailed logging of tool calls and arguments
- Added --tracing-dir flag to save tool call input/output as JSON files
- Updated start command to pass debug settings to ShellToolProvider

## Tool Result Helper Methods

Added helper methods to easily create ToolResults with different content types (text, JSON, images, resources).
Expand Down
20 changes: 18 additions & 2 deletions cmd/mcp-server/cmds/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type StartCommandSettings struct {
Transport string `glazed.parameter:"transport"`
Port int `glazed.parameter:"port"`
Repositories []string `glazed.parameter:"repositories"`
Debug bool `glazed.parameter:"debug"`
TracingDir string `glazed.parameter:"tracing-dir"`
}

type StartCommand struct {
Expand Down Expand Up @@ -57,7 +59,6 @@ func getWeather(city string, includeWind bool) WeatherData {
}

func NewStartCommand() (*StartCommand, error) {

return &StartCommand{
CommandDescription: cmds.NewCommandDescription(
"start",
Expand Down Expand Up @@ -86,6 +87,18 @@ Available transports:
parameters.WithHelp("List of directories containing shell command repositories"),
parameters.WithDefault([]string{}),
),
parameters.NewParameterDefinition(
"debug",
parameters.ParameterTypeBool,
parameters.WithHelp("Enable debug mode for shell tool provider"),
parameters.WithDefault(false),
),
parameters.NewParameterDefinition(
"tracing-dir",
parameters.ParameterTypeString,
parameters.WithHelp("Directory to store tool call traces"),
parameters.WithDefault(""),
),
),
cmds.WithLayersList(),
),
Expand Down Expand Up @@ -201,7 +214,10 @@ func (c *StartCommand) Run(
log.Debug().Str("name", cmd.Description().Name).Msg("Loaded shell command")
}

toolProvider, err := cmds2.NewShellToolProvider(commands)
toolProvider, err := cmds2.NewShellToolProvider(commands,
cmds2.WithDebug(s.Debug),
cmds2.WithTracingDir(s.TracingDir),
)
if err != nil {
log.Error().Err(err).Msg("Error creating shell tool provider")
return err
Expand Down

0 comments on commit 8e06d1f

Please sign in to comment.