Skip to content

Commit 2b8a916

Browse files
committed
fix issues for gemini working with mcps
1 parent 080e072 commit 2b8a916

File tree

7 files changed

+30
-9
lines changed

7 files changed

+30
-9
lines changed

AgentCrew/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.6.1-1"
1+
__version__ = "0.6.1-2"

AgentCrew/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ def run_update_command():
216216

217217
if system == "linux" or system == "darwin": # Darwin is macOS
218218
# Linux/macOS update command
219-
command = "uv tool upgrade agentcrew-ai"
219+
command = "uv tool install --reinstall --python=3.12 agentcrew-ai@latest"
220220
click.echo("🐧 Running Linux/macOS update command...")
221221

222222
elif system == "windows":
223223
# Windows update command
224-
command = "uv tool upgrade agentcrew-ai"
224+
command = "uv tool install --reinstall --python=3.12 agentcrew-ai@latest"
225225
click.echo("🪟 Running Windows update command...")
226226

227227
else:

AgentCrew/modules/agents/local_agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime
2+
import os
23
from typing import Dict, Any, List, Optional
34
from AgentCrew.modules.llm.base import BaseLLMService
45
from AgentCrew.modules.llm.message import MessageTransformer
@@ -176,7 +177,7 @@ def set_system_prompt(self, prompt: str):
176177
"""
177178
self.system_prompt = prompt.replace(
178179
"{current_date}", datetime.today().strftime("%A, %d/%m/%Y")
179-
)
180+
).replace("{cwd}", os.getcwd())
180181

181182
def set_custom_system_prompt(self, prompt: str):
182183
"""

AgentCrew/modules/google/native_service.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,21 @@ def _build_schema(self, param_def):
255255
type=types.Type(param_type),
256256
description=param_def.get("description", None),
257257
)
258+
if "const" in param_def.keys():
259+
schema.default = param_def.get("const", None)
260+
261+
if "enum" in param_def.keys():
262+
schema.enum = param_def.get("enum", [])
263+
264+
if "anyOf" in param_def.keys():
265+
schema.any_of = [
266+
self._build_schema(item) for item in param_def.get("anyOf", [])
267+
]
258268
if param_type == "OBJECT":
259269
schema.properties = {}
260-
if "properties" in param_def:
270+
if "properties" in param_def.keys():
261271
for key in param_def.get("properties", {}):
262-
prop = param_def.get("properties").get("key", {})
272+
prop = param_def.get("properties").get(key, {})
263273
schema.properties[key] = self._build_schema(prop)
264274
elif param_type == "ARRAY":
265275
itemsSchema = self._build_schema(param_def.get("items"))
@@ -293,10 +303,12 @@ def register_tool(self, tool_definition, handler_function):
293303
tool_definition["function"].get("parameters", {}).get("required", [])
294304
)
295305
description = tool_definition["function"].get("description", "")
306+
defs = tool_definition["function"].get("parameters", {}).get("$defs", {})
296307
else:
297308
parameters = tool_definition.get("parameters", {}).get("properties", {})
298309
required = tool_definition.get("parameters", {}).get("required", [])
299310
description = tool_definition.get("description", "")
311+
defs = tool_definition.get("parameters", {}).get("$defs", {})
300312

301313
# Create a function declaration for Google GenAI
302314
function_declaration = types.FunctionDeclaration(
@@ -315,6 +327,14 @@ def register_tool(self, tool_definition, handler_function):
315327
function_declaration.parameters is not None
316328
and function_declaration.parameters.properties is not None
317329
):
330+
if param_def.get("$ref", ""):
331+
ref_key = param_def["$ref"].lstrip("#/$defs/")
332+
if ref_key in defs.keys():
333+
function_declaration.parameters.properties[param_name] = (
334+
self._build_schema(defs[ref_key])
335+
)
336+
continue
337+
318338
function_declaration.parameters.properties[param_name] = (
319339
self._build_schema(param_def)
320340
)

AgentCrew/modules/gui/components/chat_components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def append_message(self, text, is_user=True, message_index=None, agent_name=None
143143
)
144144
if is_user:
145145
container_layout.addStretch(1) # Push to left
146-
container_layout.addWidget(message_bubble, 1)
146+
container_layout.addWidget(message_bubble, 2)
147147
else:
148148
# container_layout.addStretch(1) # Push to right
149149
container_layout.addWidget(message_bubble)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "agentcrew-ai"
3-
version = "0.6.1-1"
3+
version = "0.6.1-2"
44
requires-python = ">=3.12"
55
classifiers = [
66
"Programming Language :: Python :: 3",

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)