feat(mcp): add describe_tools and annotate_tool functionality
* Implement DescribeTool for listing available MCP tools with annotations. * Add UpsertToolAnnotation and GetToolAnnotations methods for managing tool notes. * Create tool_annotations table for storing tool usage notes.
This commit is contained in:
@@ -188,6 +188,7 @@ func routes(logger *slog.Logger, cfg *config.Config, info buildinfo.Info, db *st
|
||||
CRM: tools.NewCRMTool(db),
|
||||
Skills: tools.NewSkillsTool(db, activeProjects),
|
||||
ChatHistory: tools.NewChatHistoryTool(db, activeProjects),
|
||||
Describe: tools.NewDescribeTool(db, mcpserver.BuildToolCatalog()),
|
||||
}
|
||||
|
||||
mcpHandler, err := mcpserver.New(cfg.MCP, logger, toolSet, activeProjects.Clear)
|
||||
@@ -207,6 +208,7 @@ func routes(logger *slog.Logger, cfg *config.Config, info buildinfo.Info, db *st
|
||||
}
|
||||
mux.HandleFunc("/favicon.ico", serveFavicon)
|
||||
mux.HandleFunc("/images/project.jpg", serveHomeImage)
|
||||
mux.HandleFunc("/images/icon.png", serveIcon)
|
||||
mux.HandleFunc("/llm", serveLLMInstructions)
|
||||
|
||||
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -342,3 +344,26 @@ func serveHomeImage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
_, _ = w.Write(homeImage)
|
||||
}
|
||||
|
||||
func serveIcon(w http.ResponseWriter, r *http.Request) {
|
||||
if iconImage == nil {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
if r.Method != http.MethodGet && r.Method != http.MethodHead {
|
||||
w.Header().Set("Allow", "GET, HEAD")
|
||||
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "image/png")
|
||||
w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
if r.Method == http.MethodHead {
|
||||
return
|
||||
}
|
||||
|
||||
_, _ = w.Write(iconImage)
|
||||
}
|
||||
|
||||
BIN
internal/app/static/icon.png
Normal file
BIN
internal/app/static/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 285 KiB |
@@ -12,6 +12,7 @@ var (
|
||||
|
||||
faviconICO = mustReadStaticFile("favicon.ico")
|
||||
homeImage = mustReadStaticFile("avelonmemorycrystal.jpg")
|
||||
iconImage = tryReadStaticFile("icon.png")
|
||||
)
|
||||
|
||||
func mustReadStaticFile(name string) []byte {
|
||||
@@ -22,3 +23,11 @@ func mustReadStaticFile(name string) []byte {
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
func tryReadStaticFile(name string) []byte {
|
||||
data, err := fs.ReadFile(staticFiles, "static/"+name)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user