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

Method AddChatContext

codersdk/agentsdk/agentsdk.go:999–1012  ·  view source on GitHub ↗

AddChatContext adds context-file and skill parts to an active chat.

(ctx context.Context, req AddChatContextRequest)

Source from the content-addressed store, hash-verified

997
998// AddChatContext adds context-file and skill parts to an active chat.
999func (c *Client) AddChatContext(ctx context.Context, req AddChatContextRequest) (AddChatContextResponse, error) {
1000 res, err := c.SDK.Request(ctx, http.MethodPost, "/api/v2/workspaceagents/me/experimental/chat-context", req)
1001 if err != nil {
1002 return AddChatContextResponse{}, xerrors.Errorf("execute request: %w", err)
1003 }
1004 defer res.Body.Close()
1005
1006 if res.StatusCode != http.StatusOK {
1007 return AddChatContextResponse{}, codersdk.ReadBodyAsError(res)
1008 }
1009
1010 var resp AddChatContextResponse
1011 return resp, json.NewDecoder(res.Body).Decode(&resp)
1012}
1013
1014// ClearChatContext soft-deletes context-file and skill messages from an active chat.
1015func (c *Client) ClearChatContext(ctx context.Context, req ClearChatContextRequest) (ClearChatContextResponse, error) {

Callers 2

TestAgentChatContextFunction · 0.80
chatContextAddCommandMethod · 0.80

Calls 4

ReadBodyAsErrorFunction · 0.92
CloseMethod · 0.65
RequestMethod · 0.45
ErrorfMethod · 0.45

Tested by 1

TestAgentChatContextFunction · 0.64