Skip to content

Commit f53e679

Browse files
committed
added the press_enter for the type tool
1 parent f840527 commit f53e679

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,16 @@ def click_tool(loc:tuple[int,int],button:Literal['left','right','middle']='left'
117117
return f'{num_clicks.get(clicks)} {button} Clicked on {control.Name} Element with ControlType {control.ControlTypeName} at ({x},{y}).'
118118

119119
@mcp.tool(name='Type-Tool',description='Type text into input fields, text areas, or focused elements. Set clear=True to replace existing text, False to append. Click on target element coordinates first.')
120-
def type_tool(loc:tuple[int,int],text:str,clear:bool=False):
120+
def type_tool(loc:tuple[int,int],text:str,clear:bool=False,press_enter:bool=False)->str:
121121
x,y=loc
122122
pg.click(x=x, y=y)
123123
control=desktop.get_element_under_cursor()
124124
if clear=='True':
125125
pg.hotkey('ctrl','a')
126126
pg.press('backspace')
127127
pg.typewrite(text,interval=0.1)
128+
if press_enter:
129+
pg.press('enter')
128130
return f'Typed {text} on {control.Name} Element with ControlType {control.ControlTypeName} at ({x},{y}).'
129131

130132
@mcp.tool(name='Resize-Tool',description='Resize a specific application window (e.g., "notepad", "calculator", "chrome", etc.) to specific size (WIDTHxHEIGHT) or move to specific location (X,Y).')

0 commit comments

Comments
 (0)