> ## 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.

# Reorder Tools

> Set the sort order of tools within a server.

Atomically writes the new `sort_order` for every tool listed in `tool_ids`. The position in the array becomes the tool's order; tools belonging to the server but missing from the array are left untouched.

<Note>
  IDs in the array that don't belong to the target server are silently dropped — only valid tool UUIDs scoped to the server are reordered. The endpoint always returns 200 if the server resolves; per-tool errors are not surfaced.
</Note>

## Path Parameters

<ParamField path="server_id" type="string" required>
  The UUID of the server (e.g. `836995ae-1cff-41ec-823e-a4f07ccca3a0`). Numeric IDs are also accepted for backwards compatibility.
</ParamField>

## Body Parameters

<ParamField body="tool_ids" type="array" required>
  Array of tool UUIDs in the desired order — index `0` becomes the first tool. UUIDs not belonging to the server are skipped.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
       --url https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/reorder \
       --header 'Authorization: Bearer gmcp_your_api_key' \
       --header 'content-type: application/json' \
       --data '{
         "tool_ids": [
           "5376af81-6bb8-4b01-800c-508d7672e394",
           "e7a3c1d2-4f5b-6a7c-8d9e-0f1a2b3c4d5e",
           "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809"
         ]
       }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/reorder",
      headers={
          "Authorization": "Bearer gmcp_your_api_key",
          "Content-Type": "application/json",
      },
      json={
          "tool_ids": [
              "5376af81-6bb8-4b01-800c-508d7672e394",
              "e7a3c1d2-4f5b-6a7c-8d9e-0f1a2b3c4d5e",
          ]
      },
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/reorder",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer gmcp_your_api_key",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        tool_ids: [
          "5376af81-6bb8-4b01-800c-508d7672e394",
          "e7a3c1d2-4f5b-6a7c-8d9e-0f1a2b3c4d5e",
        ],
      }),
    }
  );
  const data = await response.json();
  ```

  ```php PHP theme={null}
  $response = wp_remote_post(
      "https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/reorder",
      [
          "headers" => [
              "Authorization" => "Bearer gmcp_your_api_key",
              "Content-Type"  => "application/json",
          ],
          "body" => wp_json_encode([
              "tool_ids" => [
                  "5376af81-6bb8-4b01-800c-508d7672e394",
                  "e7a3c1d2-4f5b-6a7c-8d9e-0f1a2b3c4d5e",
              ],
          ]),
      ]
  );
  $data = json_decode( wp_remote_retrieve_body( $response ), true );
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "reordered": true
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "code": "getmcp_invalid_params",
    "message": "tool_ids must be an array of tool UUIDs.",
    "data": { "status": 400 }
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "code": "getmcp_not_found",
    "message": "Server not found.",
    "data": { "status": 404 }
  }
  ```
</ResponseExample>
