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

Method Ping

go/client.go:1557–1572  ·  view source on GitHub ↗

Ping sends a ping request to the server to verify connectivity. The message parameter is optional and will be echoed back in the response. Returns a PingResponse containing the message and server timestamp, or an error. Example: resp, err := client.Ping(context.Background(), "health check") if

(ctx context.Context, message string)

Source from the content-addressed store, hash-verified

1555// log.Printf("Server responded at %s", resp.Timestamp)
1556// }
1557func (c *Client) Ping(ctx context.Context, message string) (*PingResponse, error) {
1558 if c.client == nil {
1559 return nil, fmt.Errorf("client not connected")
1560 }
1561
1562 result, err := c.client.Request(ctx, "ping", pingRequest{Message: message})
1563 if err != nil {
1564 return nil, err
1565 }
1566
1567 var response PingResponse
1568 if err := json.Unmarshal(result, &response); err != nil {
1569 return nil, err
1570 }
1571 return &response, nil
1572}
1573
1574// GetStatus returns CLI status including version and protocol information
1575func (c *Client) GetStatus(ctx context.Context) (*GetStatusResponse, error) {

Callers 5

verifyProtocolVersionMethod · 0.95
TestClientE2EFunction · 0.95
TestClientOptionsE2EFunction · 0.95
TestConnectionTokenFunction · 0.95

Calls 1

RequestMethod · 0.45

Tested by 4

TestClientE2EFunction · 0.76
TestClientOptionsE2EFunction · 0.76
TestConnectionTokenFunction · 0.76