MCPcopy Index your code
hub / github.com/coder/coder / resolveSubagentDefinition

Function resolveSubagentDefinition

coderd/x/chatd/subagent_catalog.go:215–233  ·  view source on GitHub ↗
(
	ctx context.Context,
	p *Server,
	currentChat database.Chat,
	rawSubagentType string,
)

Source from the content-addressed store, hash-verified

213}
214
215func resolveSubagentDefinition(
216 ctx context.Context,
217 p *Server,
218 currentChat database.Chat,
219 rawSubagentType string,
220) (subagentDefinition, error) {
221 subagentType := strings.TrimSpace(rawSubagentType)
222 def, ok := lookupSubagentDefinition(subagentType)
223 if !ok {
224 return subagentDefinition{}, xerrors.Errorf(
225 "type must be one of: %s",
226 strings.Join(availableSubagentTypeIDs(ctx, p, currentChat), ", "),
227 )
228 }
229 if reason := def.unavailableReasonText(ctx, p, currentChat); reason != "" {
230 return subagentDefinition{}, xerrors.New(reason)
231 }
232 return def, nil
233}
234
235func validateSubagentSpawnParent(currentChat database.Chat) error {
236 if currentChat.ParentChatID.Valid {

Callers 1

subagentToolsMethod · 0.85

Calls 5

lookupSubagentDefinitionFunction · 0.85
availableSubagentTypeIDsFunction · 0.85
unavailableReasonTextMethod · 0.80
NewMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected