MCPcopy Create free account
hub / github.com/github/copilot-sdk / Send

Method Send

go/rpc/zrpc.go:17858–17908  ·  view source on GitHub ↗

Sends a user message to the session and returns its message ID. RPC method: session.send. Parameters: Parameters for sending a user message to the session Returns: Result of sending a user message Experimental: Send is an experimental API and may change or be removed in future versions.

(ctx context.Context, params *SendRequest)

Source from the content-addressed store, hash-verified

17856// Returns: Result of sending a user message
17857// Experimental: Send is an experimental API and may change or be removed in future versions.
17858func (a *SessionRPC) Send(ctx context.Context, params *SendRequest) (*SendResult, error) {
17859 req := map[string]any{"sessionId": a.common.sessionID}
17860 if params != nil {
17861 if params.AgentMode != nil {
17862 req["agentMode"] = *params.AgentMode
17863 }
17864 if params.Attachments != nil {
17865 req["attachments"] = params.Attachments
17866 }
17867 if params.Billable != nil {
17868 req["billable"] = *params.Billable
17869 }
17870 if params.DisplayPrompt != nil {
17871 req["displayPrompt"] = *params.DisplayPrompt
17872 }
17873 if params.Mode != nil {
17874 req["mode"] = *params.Mode
17875 }
17876 if params.Prepend != nil {
17877 req["prepend"] = *params.Prepend
17878 }
17879 req["prompt"] = params.Prompt
17880 if params.RequestHeaders != nil {
17881 req["requestHeaders"] = params.RequestHeaders
17882 }
17883 if params.RequiredTool != nil {
17884 req["requiredTool"] = *params.RequiredTool
17885 }
17886 if params.Source != nil {
17887 req["source"] = *params.Source
17888 }
17889 if params.Traceparent != nil {
17890 req["traceparent"] = *params.Traceparent
17891 }
17892 if params.Tracestate != nil {
17893 req["tracestate"] = *params.Tracestate
17894 }
17895 if params.Wait != nil {
17896 req["wait"] = *params.Wait
17897 }
17898 }
17899 raw, err := a.common.client.Request(ctx, "session.send", req)
17900 if err != nil {
17901 return nil, err
17902 }
17903 var result SendResult
17904 if err := json.Unmarshal(raw, &result); err != nil {
17905 return nil, err
17906 }
17907 return &result, nil
17908}
17909
17910// Shutdown shuts down the session and persists its final state. Awaits any deferred
17911// sessionEnd hooks before resolving so user-supplied hook scripts complete before the

Callers 15

mainFunction · 0.45
TestAbortE2EFunction · 0.45
TestSuspendE2EFunction · 0.45
TestPendingWorkResumeE2EFunction · 0.45
TestPermissionsE2EFunction · 0.45
TestResumeMCPOAuthE2EFunction · 0.45
TestModeHandlersE2EFunction · 0.45
TestToolResultsE2EFunction · 0.45
TestClientE2EFunction · 0.45
TestToolsE2EFunction · 0.45
TestSessionE2EFunction · 0.45

Calls 1

RequestMethod · 0.45

Tested by 15

TestAbortE2EFunction · 0.36
TestSuspendE2EFunction · 0.36
TestPendingWorkResumeE2EFunction · 0.36
TestPermissionsE2EFunction · 0.36
TestResumeMCPOAuthE2EFunction · 0.36
TestModeHandlersE2EFunction · 0.36
TestToolResultsE2EFunction · 0.36
TestClientE2EFunction · 0.36
TestToolsE2EFunction · 0.36
TestSessionE2EFunction · 0.36
TestMCPServersE2EFunction · 0.36