get_cursor_position
Retrieve the current mouse cursor position in screen coordinates for macOS automation tasks.
Instructions
Get the current mouse cursor position in screen coordinates.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_cursor_position"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/screen.ts:97-109 (handler)The implementation of the get_cursor_position tool handler, which calls the cursor input helper and returns the x and y coordinates.
async function handleGetCursorPosition(): Promise<CallToolResult> { const response = await runInputHelper("cursor", {}); const { x, y } = CursorPositionResponseSchema.parse(response); return { content: [ { type: "text" as const, text: JSON.stringify({ x, y }), }, ], }; } - src/tools/screen.ts:56-66 (registration)The registration of the get_cursor_position tool within the tool definitions list.
{ name: "get_cursor_position", description: "Get the current mouse cursor position in screen coordinates.", inputSchema: zodToToolInputSchema(GetCursorPositionInputSchema), annotations: { readOnlyHint: true, destructiveHint: false, }, }, ];