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

Method formatProperty

backend/api/mcp/tool_search.go:189–217  ·  view source on GitHub ↗
(sb *strings.Builder, prop PropertyInfo)

Source from the content-addressed store, hash-verified

187}
188
189func (*Server) formatProperty(sb *strings.Builder, prop PropertyInfo) {
190 required := ""
191 if prop.Required {
192 required = " (required)"
193 }
194
195 desc := ""
196 // Check if type has a known short description
197 if shortDesc, ok := GetTypeDescription(prop.Type); ok {
198 desc = fmt.Sprintf(" // %s", shortDesc)
199 } else if prop.Description != "" {
200 // Remove newlines and truncate long descriptions
201 cleanDesc := strings.ReplaceAll(prop.Description, "\n", " ")
202 cleanDesc = strings.ReplaceAll(cleanDesc, "\r", "")
203 // Truncate at 100 chars
204 if truncated, ok := common.TruncateString(cleanDesc, 97); ok {
205 cleanDesc = truncated + "..."
206 }
207 desc = fmt.Sprintf(" // %s", cleanDesc)
208 }
209
210 sb.WriteString(" \"")
211 sb.WriteString(prop.Name)
212 sb.WriteString("\": ")
213 sb.WriteString(prop.Type)
214 sb.WriteString(required)
215 sb.WriteString(desc)
216 sb.WriteString("\n")
217}

Callers 2

formatEndpointDetailMethod · 0.95
formatSchemaDetailMethod · 0.95

Calls 2

TruncateStringFunction · 0.92
GetTypeDescriptionFunction · 0.85

Tested by

no test coverage detected