> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getmcp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ping

> Check server connectivity with a simple ping/pong exchange.

The `ping` method verifies the server is alive and responding. Use it for health checks and connection verification.

## MCP Endpoint

```
POST https://yoursite.com/mcp/{slug}
Content-Type: application/json
```

## Request

<ParamField body="jsonrpc" type="string" required>
  Must be `"2.0"`.
</ParamField>

<ParamField body="id" type="integer | string" required>
  Arbitrary request identifier echoed back unchanged in the response.
</ParamField>

<ParamField body="method" type="string" required>
  Must be `"ping"`.
</ParamField>

<ParamField body="params" type="object">
  Empty object `{}`. No parameters accepted.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
       --url https://yoursite.com/mcp/my-weather-tools \
       --header 'content-type: application/json' \
       --header 'Mcp-Session-Id: your_session_id' \
       --data '
  {
    "jsonrpc": "2.0",
    "id": 2,
    "method": "ping",
    "params": {}
  }
  '
  ```

  ```go Go theme={null}
  package main
  import (
  	"fmt"
  	"io"
  	"net/http"
  	"strings"
  )

  func main() {
  	body := strings.NewReader(`{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "ping",
    "params": {}
  }`)

  	req, _ := http.NewRequest("POST", "https://yoursite.com/mcp/my-weather-tools", body)
  	req.Header.Set("Content-Type", "application/json")

  	client := &http.Client{}
  	resp, _ := client.Do(req)
  	defer resp.Body.Close()
  	data, _ := io.ReadAll(resp.Body)
  	fmt.Println(string(data))
  }
  ```

  ```java Java theme={null}
  import java.net.URI;
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;

  public class Main {
      public static void main(String[] args) throws Exception {
          String json = "{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 2,\n  \"method\": \"ping\",\n  \"params\": {}\n}";

          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create("https://yoursite.com/mcp/my-weather-tools"))
              .header("Content-Type", "application/json")
              .POST(HttpRequest.BodyPublishers.ofString(json))
              .build();

          HttpClient client = HttpClient.newHttpClient();
          HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
          System.out.println(response.body());
      }
  }
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'
  require 'uri'

  uri = URI('https://yoursite.com/mcp/my-weather-tools')
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = uri.scheme == 'https'

  request = Net::HTTP::Post.new(uri)
  request['Content-Type'] = 'application/json'
  request.body = '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "ping",
    "params": {}
  }'

  response = http.request(request)
  puts JSON.parse(response.body)
  ```
</RequestExample>

## Response

<ResponseField name="result" type="object">
  Always an empty object `{}`. A successful ping response confirms the server is reachable and processing requests.
</ResponseField>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "jsonrpc": "2.0",
    "id": 2,
    "result": {}
  }
  ```
</ResponseExample>

The ping response is always an empty result object `{}`.
