MCPcopy Create free account
hub / github.com/coder/agentapi / parseAgentType

Function parseAgentType

cmd/server/server.go:65–78  ·  view source on GitHub ↗
(firstArg string, agentTypeVar string)

Source from the content-addressed store, hash-verified

63}
64
65func parseAgentType(firstArg string, agentTypeVar string) (AgentType, error) {
66 // if the agent type is provided, use it
67 if castedAgentType, ok := agentTypeAliases[agentTypeVar]; ok {
68 return castedAgentType, nil
69 }
70 if agentTypeVar != "" {
71 return AgentTypeCustom, fmt.Errorf("invalid agent type: %s", agentTypeVar)
72 }
73 // if the agent type is not provided, guess it from the first argument
74 if castedFirstArg, ok := agentTypeAliases[firstArg]; ok {
75 return castedFirstArg, nil
76 }
77 return AgentTypeCustom, nil
78}
79
80func runServer(ctx context.Context, logger *slog.Logger, argsToPass []string) error {
81 agent := argsToPass[0]

Callers 2

runServerFunction · 0.85
TestParseAgentTypeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseAgentTypeFunction · 0.68