fix: add missing descriptions for various tools (#213)

Fixes interoperability issues. Without descriptions, several MCP tools throw errors and refuse to parse the responses. Easiest to reproduce in mcp-probe.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/213
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Torben Nehmer <torben@nehmer.net>
This commit is contained in:
Torben Nehmer
2026-07-19 19:53:16 +00:00
committed by Lunny Xiao
parent 93346f2c42
commit fec9db1072
12 changed files with 54 additions and 0 deletions
+28
View File
@@ -2,8 +2,36 @@ package operation
import (
"testing"
"gitea.com/gitea/gitea-mcp/pkg/flag"
)
// TestAllToolsHaveDescriptions ensures every registered tool sets a non-empty
// Tool.Description. mcp-go only serializes the "description" field of a tool
// when it is non-empty, so an omitted description makes strict MCP clients
// (e.g. mcp-probe) reject the tools/list response with "missing field
// `description`".
func TestAllToolsHaveDescriptions(t *testing.T) {
origRO, origAllow := flag.ReadOnly, flag.AllowedTools
t.Cleanup(func() {
flag.ReadOnly, flag.AllowedTools = origRO, origAllow
})
flag.ReadOnly = false
flag.AllowedTools = nil
var missing []string
for _, d := range domainTools {
for _, st := range d.Tools() {
if st.Tool.Description == "" {
missing = append(missing, st.Tool.Name)
}
}
}
if len(missing) > 0 {
t.Errorf("tools missing a description: %v", missing)
}
}
func TestParseAuthToken(t *testing.T) {
tests := []struct {
name string