Refactors DemoMCP tool handler to integrate with DemoGRPC for fact retrieval and updates server instructions.

This commit is contained in:
2025-08-27 17:02:53 -04:00
parent 214d5d76c3
commit e3be406eba
5 changed files with 141 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ import (
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/config"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/demo/demogrpc"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/demo/demohttp"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/demo/demomcp"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/service"
)
@@ -20,6 +21,7 @@ type DemoService struct {
config *config.ServiceConfig
http *demohttp.DemoHTTPServer
grpc *demogrpc.DemoGRPCServer
mcp *demomcp.DemoMCPServer
}
func (d *DemoService) Init(ctx context.Context, config *config.ServiceConfig,
@@ -31,6 +33,7 @@ func (d *DemoService) Init(ctx context.Context, config *config.ServiceConfig,
// This is, after all, a demo app. Just implement the interface.
d.http = demohttp.NewDemoHTTPServer(ctx, config)
d.grpc = demogrpc.NewDemoGRPCServer(ctx, config)
d.mcp = demomcp.NewDemoMCPServer(ctx, config)
// TODO: This should actually do shutdown stuff
return func(_ context.Context) (string, error) {
@@ -49,6 +52,7 @@ func (d *DemoService) GetHTTP() *optshttp.AppHTTP {
return &optshttp.AppHTTP{
Ctx: d.ctx,
Funcs: d.http.GetHandleFuncs(),
Handlers: d.mcp.GetHandlers(),
HealthChecks: d.http.GetHealthCheckFuncs(),
}
}