@@ -14,7 +14,8 @@ import (
1414 "github.com/github/github-mcp-server/pkg/toolsets"
1515 "github.com/github/github-mcp-server/pkg/translations"
1616 gogithub "github.com/google/go-github/v77/github"
17- "github.com/mark3labs/mcp-go/mcp"
17+ "github.com/google/jsonschema-go/jsonschema"
18+ "github.com/modelcontextprotocol/go-sdk/mcp"
1819 "github.com/shurcooL/githubv4"
1920 "github.com/spf13/cobra"
2021)
@@ -224,7 +225,12 @@ func generateToolDoc(tool mcp.Tool) string {
224225 lines = append (lines , fmt .Sprintf ("- **%s** - %s" , tool .Name , tool .Annotations .Title ))
225226
226227 // Parameters
227- schema := tool .InputSchema
228+ schema , ok := tool .InputSchema .(* jsonschema.Schema )
229+ if ! ok {
230+ lines = append (lines , " - No parameters required" )
231+ return strings .Join (lines , "\n " )
232+ }
233+
228234 if len (schema .Properties ) > 0 {
229235 // Get parameter names and sort them for deterministic order
230236 var paramNames []string
@@ -245,26 +251,19 @@ func generateToolDoc(tool mcp.Tool) string {
245251 typeStr := "unknown"
246252 description := ""
247253
248- if propMap , ok := prop .(map [string ]interface {}); ok {
249- if typeVal , ok := propMap ["type" ].(string ); ok {
250- if typeVal == "array" {
251- if items , ok := propMap ["items" ].(map [string ]interface {}); ok {
252- if itemType , ok := items ["type" ].(string ); ok {
253- typeStr = itemType + "[]"
254- }
255- } else {
256- typeStr = "array"
257- }
258- } else {
259- typeStr = typeVal
260- }
261- }
262-
263- if desc , ok := propMap ["description" ].(string ); ok {
264- description = desc
254+ switch prop .Type {
255+ case "array" :
256+ if prop .Items != nil {
257+ typeStr = prop .Items .Type + "[]"
258+ } else {
259+ typeStr = "array"
265260 }
261+ default :
262+ typeStr = prop .Type
266263 }
267264
265+ description = prop .Description
266+
268267 paramLine := fmt .Sprintf (" - `%s`: %s (%s, %s)" , propName , description , typeStr , requiredStr )
269268 lines = append (lines , paramLine )
270269 }
0 commit comments