Performs a mouse click at the specified X and Y coordinates on the screen. This endpoint allows an agent to programmatically control the mouse to click at a precise position.
The request body must contain the X and Y coordinates where the mouse click should be performed.
| Parameter | Type | Required | Description |
|---|---|---|---|
| X | integer | Required | The X coordinate on the screen where the click should be performed. |
| Y | integer | Required | The Y coordinate on the screen where the click should be performed. |
{
"x": 500,
"y": 300
}
The response includes information about whether the mouse click was successful, along with a message and timestamp.
| Parameter | Type | Description |
|---|---|---|
| Success | boolean | Indicates whether the mouse click action was performed successfully. |
| Message | string | A message providing additional information about the action's execution. |
| Timestamp | string (ISO 8601 date) | The time when the action was executed. |
{
"Success": true,
"Message": "Mouse click performed successfully at coordinates X:500, Y:300",
"Timestamp": "2025-03-12T09:07:12.000Z"
}
import requests
import json
def mouse_click(api_key, x, y):
url = "https://your-tools-server.com/tools-api/mouse/click"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
payload = {
"x": x,
"y": y
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
return response.json()
else:
print(f"Error: {response.status_code}")
print(response.text)
return None
# Example usage
api_key = "your-api-key"
result = mouse_click(api_key, 500, 300)
print(result)
interface MouseClickRequest {
x: number;
y: number;
}
interface MouseClickResponse {
Success: boolean;
Message: string;
Timestamp: string;
}
async function mouseClick(apiKey: string, x: number, y: number): Promise {
const url = 'https://your-tools-server.com/tools-api/mouse/click';
const headers = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
};
const payload: MouseClickRequest = {
x: x,
y: y
};
try {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json() as MouseClickResponse;
} catch (error) {
console.error('Error performing mouse click:', error);
throw error;
}
}
// Example usage
const apiKey = 'your-api-key';
mouseClick(apiKey, 500, 300)
.then(result => console.log(result))
.catch(error => console.error(error));
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
public class ToolsServerClient
{
private readonly HttpClient _httpClient;
private readonly string _apiKey;
public ToolsServerClient(string apiKey)
{
_httpClient = new HttpClient();
_apiKey = apiKey;
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _apiKey);
}
public class MouseClickRequest
{
public int X { get; set; }
public int Y { get; set; }
}
public class MouseClickResponse
{
public bool Success { get; set; }
public string Message { get; set; }
public DateTime Timestamp { get; set; }
}
public async Task MouseClickAsync(int x, int y)
{
var request = new MouseClickRequest
{
X = x,
Y = y
};
var content = new StringContent(
JsonSerializer.Serialize(request),
Encoding.UTF8,
"application/json");
var response = await _httpClient.PostAsync(
"https://your-tools-server.com/tools-api/mouse/click",
content);
response.EnsureSuccessStatusCode();
var responseBody = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize(responseBody);
}
}
// Example usage
class Program
{
static async Task Main(string[] args)
{
var client = new ToolsServerClient("your-api-key");
var result = await client.MouseClickAsync(500, 300);
Console.WriteLine($"Success: {result.Success}, Message: {result.Message}");
}
}
This example shows how to click on a button located at coordinates (500, 300) on the screen.
// Request
{
"x": 500,
"y": 300
}
// Response
{
"Success": true,
"Message": "Mouse click performed successfully at coordinates X:500, Y:300",
"Timestamp": "2025-03-12T09:07:12.000Z"
}
This example shows how to click in a text field located at coordinates (800, 450) on the screen.
// Request
{
"x": 800,
"y": 450
}
// Response
{
"Success": true,
"Message": "Mouse click performed successfully at coordinates X:800, Y:450",
"Timestamp": "2025-03-12T09:07:15.000Z"
}