MCPcopy Create free account
hub / github.com/bytebase/bytebase / formatEndpoints

Method formatEndpoints

backend/api/mcp/tool_search.go:93–114  ·  view source on GitHub ↗
(endpoints []*EndpointInfo, limit int)

Source from the content-addressed store, hash-verified

91}
92
93func (*Server) formatEndpoints(endpoints []*EndpointInfo, limit int) string {
94 var sb strings.Builder
95
96 if limit > 0 && len(endpoints) > limit {
97 fmt.Fprintf(&sb, "Showing %d of %d results:\n\n", limit, len(endpoints))
98 endpoints = endpoints[:limit]
99 } else {
100 fmt.Fprintf(&sb, "Found %d endpoints:\n\n", len(endpoints))
101 }
102
103 for i, ep := range endpoints {
104 fmt.Fprintf(&sb, "### %d. %s/%s\n", i+1, ep.Service, ep.Method)
105 fmt.Fprintf(&sb, "%s\n", ep.Summary)
106
107 if len(ep.Permissions) > 0 {
108 fmt.Fprintf(&sb, "Permissions: `%s`\n", strings.Join(ep.Permissions, "`, `"))
109 }
110 sb.WriteString("\n")
111 }
112
113 return sb.String()
114}
115
116func (s *Server) formatEndpointDetail(operationID string) string {
117 ep, ok := s.openAPIIndex.GetEndpoint(operationID)

Callers 1

handleSearchAPIMethod · 0.95

Calls 2

JoinMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected