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

Function NewDeps

codersdk/toolsdk/toolsdk.go:63–83  ·  view source on GitHub ↗
(client *codersdk.Client, opts ...func(*Deps))

Source from the content-addressed store, hash-verified

61)
62
63func NewDeps(client *codersdk.Client, opts ...func(*Deps)) (Deps, error) {
64 d := Deps{
65 coderClient: client,
66 }
67 for _, opt := range opts {
68 opt(&d)
69 }
70 if d.agentConnFn == nil && d.coderClient != nil {
71 workspaceClient := workspacesdk.New(d.coderClient)
72 d.agentConnFn = func(ctx context.Context, agentID uuid.UUID) (workspacesdk.AgentConn, func(), error) {
73 conn, err := workspaceClient.DialAgent(ctx, agentID, nil)
74 if err != nil {
75 return nil, nil, err
76 }
77 return conn, nil, nil
78 }
79 }
80 // Allow nil client for unauthenticated operation
81 // This enables tools that don't require user authentication to function
82 return d, nil
83}
84
85// Deps provides access to tool dependencies.
86type Deps struct {

Calls 2

NewFunction · 0.92
DialAgentMethod · 0.65