Skip to content

Simplify tools and PostgreSQL configuration handling. #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ require (
gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/shaharia-lab/goai => ../goai
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.8.0 h1:mXaMVw7IqxNBxfv3LdWt9MDmcWDQ1fagDH918lOdVaQ=
github.com/sagikazarmark/locafero v0.8.0/go.mod h1:UBUyz37V+EdMS3hDF3QWIiVr/2dPrx49OMO0Bn0hJqk=
github.com/shaharia-lab/goai v0.12.0 h1:s177idIsM6GJhX3JJmyZRZ+4ve5pJnQ/QL3FaC4fMsc=
github.com/shaharia-lab/goai v0.12.0/go.mod h1:EKzvGwFBTL8eLUIw3pTA+X18IMjfy5mncFQXhvQCnAo=
github.com/shaharia-lab/mcp-tools v0.0.5 h1:Hwfigbu0CVLhGHDuqZpFxmUBGEfHiHsYj9phiP/ZQbM=
github.com/shaharia-lab/mcp-tools v0.0.5/go.mod h1:fcAmptmJ+RhK7zwAM+dpIr6cCOtjJyn3yKjvPj98DYw=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand Down
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Config struct {
Tracing TracingConfig `mapstructure:"tracing"`
Auth AuthConfig `mapstructure:"auth"`
GoogleServiceConfig GoogleConfig `mapstructure:"google"`
Tools *tools.ToolsConfig `yaml:"tools" validate:"required"`
Tools *tools.ToolsConfig `mapstructure:"tools"`
}

// TracingConfig holds the configuration for the tracing service
Expand Down Expand Up @@ -72,7 +72,7 @@ func Load(configFile string) (*Config, error) {
return nil, err
}

// Unmarshal the config into our struct
// Unmarshal into struct
if err := viper.Unmarshal(&cfg); err != nil {
return nil, err
}
Expand Down
5 changes: 1 addition & 4 deletions internal/tools/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ func (r *Registry) Init() error {
}

if r.config.Postgres.IsEnabled() {
postgres := mcptools.NewPostgreSQL(r.logger, mcptools.PostgreSQLConfig{
DefaultDatabase: r.config.Postgres.Databases[0].Name,
BlockedCommands: r.config.Postgres.Databases[0].BlockedCommands,
})
postgres := mcptools.NewPostgreSQL(r.logger, mcptools.PostgreSQLConfig{})
r.AddTool(mcptools.PostgreSQLToolName, postgres.PostgreSQLAllInOneTool())
}

Expand Down
Loading