Jarvis-Brain 0.0.3__py3-none-any.whl → 0.0.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Jarvis_Brain
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Jarvis brain
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: drissionpage
@@ -0,0 +1,7 @@
1
+ mcp_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ mcp_tools/dp_tools.py,sha256=f5jl6BHfuvqVjFplnUEvlzLbK0k0bJnMpR7cVHxWsy8,6017
3
+ mcp_tools/main.py,sha256=QS5GUQQC-zfMqQ_rFm6Kc1X4ATfalrGl_FPMR6yCp1U,380
4
+ jarvis_brain-0.0.5.dist-info/METADATA,sha256=krtKk3icbi2KWLn6bxivwtUSi-b7mOdZn_VgF4M3XVE,176
5
+ jarvis_brain-0.0.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
6
+ jarvis_brain-0.0.5.dist-info/entry_points.txt,sha256=YFQT4xpkUqt5dM5wlKPQQOqcjMuFrT9iuRAzIpAyH7U,51
7
+ jarvis_brain-0.0.5.dist-info/RECORD,,
mcp_tools/dp_tools.py CHANGED
@@ -9,9 +9,8 @@ from DrissionPage._elements.none_element import NoneElement
9
9
  from fastmcp import FastMCP
10
10
  from lxml import html, etree
11
11
 
12
- # mcp = FastMCP("JARVIS_DP_TOOLS")
13
-
14
12
  html_source_code_local_save_path = os.path.join(os.getcwd(), "html-source-code")
13
+ browser_pool = {}
15
14
 
16
15
 
17
16
  # 压缩html
@@ -75,6 +74,7 @@ def register_visit_url(mcp: FastMCP):
75
74
  }]
76
75
  }
77
76
 
77
+
78
78
  def register_get_html(mcp: FastMCP):
79
79
  @mcp.tool(name="get_html", description="使用Drissionpage获取某一个tab页的html")
80
80
  async def get_html(browser_port: int, tab_id: str) -> dict[str, Any]:
@@ -95,6 +95,7 @@ def register_get_html(mcp: FastMCP):
95
95
  }]
96
96
  }
97
97
 
98
+
98
99
  def register_get_new_tab(mcp: FastMCP):
99
100
  @mcp.tool(name="get_new_tab", description="使用Drissionpage创建一个新的tab页,在新的tab页中打开url")
100
101
  async def get_new_tab(browser_port: int, url: str) -> dict[str, Any]:
@@ -112,6 +113,7 @@ def register_get_new_tab(mcp: FastMCP):
112
113
  }]
113
114
  }
114
115
 
116
+
115
117
  def register_switch_tab(mcp: FastMCP):
116
118
  @mcp.tool(name="switch_tab", description="根据传入的tab_id切换到对应的tab页", )
117
119
  async def switch_tab(browser_port: int, tab_id: str) -> dict[str, Any]:
@@ -126,6 +128,7 @@ def register_switch_tab(mcp: FastMCP):
126
128
  }]
127
129
  }
128
130
 
131
+
129
132
  def register_close_tab(mcp: FastMCP):
130
133
  @mcp.tool(name="close_tab", description="根据传入的tab_id关闭tab页", )
131
134
  async def close_tab(browser_port, tab_id) -> dict[str, Any]:
@@ -140,6 +143,7 @@ def register_close_tab(mcp: FastMCP):
140
143
  }]
141
144
  }
142
145
 
146
+
143
147
  def register_check_selector(mcp: FastMCP):
144
148
  @mcp.tool(name="check_selector", description="查找tab页中是否包含元素")
145
149
  async def check_selector(browser_port: int, tab_id: str, css_selector: str) -> dict[str, Any]:
@@ -150,17 +154,16 @@ def register_check_selector(mcp: FastMCP):
150
154
  css_selector = "css:" + css_selector
151
155
  target_ele = target_tab.ele(css_selector)
152
156
  return {
153
- "content": [{
154
- "type": "text",
155
- "text": json.dumps({
156
- "message": f"已完成tab页:【{tab_id}】对:【{css_selector}】的检查",
157
- "tab_id": tab_id,
158
- "selector": css_selector,
159
- "selector_ele_exist": not isinstance(target_ele, NoneElement),
160
- }, ensure_ascii=False)
161
- }]
162
- }
163
-
157
+ "content": [{
158
+ "type": "text",
159
+ "text": json.dumps({
160
+ "message": f"已完成tab页:【{tab_id}】对:【{css_selector}】的检查",
161
+ "tab_id": tab_id,
162
+ "selector": css_selector,
163
+ "selector_ele_exist": not isinstance(target_ele, NoneElement),
164
+ }, ensure_ascii=False)
165
+ }]
166
+ }
164
167
 
165
168
  # def main():
166
169
  # mcp.run()
mcp_tools/main.py CHANGED
@@ -1,6 +1,5 @@
1
1
  # main.py
2
- import os
3
- from src.mcp_tools.dp_tools import *
2
+ from mcp_tools.dp_tools import *
4
3
  from fastmcp import FastMCP
5
4
 
6
5
  mcp = FastMCP("Jarvis Brain DrissionPage mcp")
@@ -1,7 +0,0 @@
1
- mcp_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- mcp_tools/dp_tools.py,sha256=TsBJM_Fdr6IreZvqoUZnDv2OJi-oMEYCLzO5cIIUVe4,5991
3
- mcp_tools/main.py,sha256=udTCzVeYLhYK_sFBuKQ9_idbF_qKY-0oTfJaigZc2_g,394
4
- jarvis_brain-0.0.3.dist-info/METADATA,sha256=OVAipWel585XsqFvWoETCsYA_RQVEakHo2l_EAa1N_I,176
5
- jarvis_brain-0.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
6
- jarvis_brain-0.0.3.dist-info/entry_points.txt,sha256=YFQT4xpkUqt5dM5wlKPQQOqcjMuFrT9iuRAzIpAyH7U,51
7
- jarvis_brain-0.0.3.dist-info/RECORD,,