Skip to content

Commit db2bb98

Browse files
authored
Merge branch 'main' into feat/github-issues-pagination
2 parents 8747a25 + b6acbda commit db2bb98

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

cookbook/tools/mcp/gibsonai.py

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,40 @@
4343
from agno.tools.mcp import MCPTools
4444

4545

46-
async def run_gibsonai_agent(message: str) -> None:
46+
async def run_gibsonai_agent(message: str):
4747
"""Run the GibsonAI agent with the given message."""
48-
async with MCPTools(
48+
mcp_tools = MCPTools(
4949
"uvx --from gibson-cli@latest gibson mcp run",
5050
timeout_seconds=300, # Extended timeout for GibsonAI operations
51-
) as mcp_tools:
52-
agent = Agent(
53-
name="GibsonAIAgent",
54-
model=OpenAIChat(id="gpt-4o"),
55-
tools=[mcp_tools],
56-
description="Agent for managing database projects and schemas",
57-
instructions=dedent("""\
58-
You are a GibsonAI database assistant. Help users manage their database projects and schemas.
59-
60-
Your capabilities include:
61-
- Creating new GibsonAI projects
62-
- Managing database schemas (tables, columns, relationships)
63-
- Deploying schema changes to hosted databases
64-
- Querying database schemas and data
65-
- Providing insights about database structure and best practices
66-
"""),
67-
markdown=True,
68-
show_tool_calls=True,
69-
)
51+
)
52+
53+
# Connect to the MCP server
54+
await mcp_tools.connect()
55+
56+
agent = Agent(
57+
name="GibsonAIAgent",
58+
model=OpenAIChat(id="gpt-4o"),
59+
tools=[mcp_tools],
60+
description="Agent for managing database projects and schemas",
61+
instructions=dedent("""\
62+
You are a GibsonAI database assistant. Help users manage their database projects and schemas.
63+
64+
Your capabilities include:
65+
- Creating new GibsonAI projects
66+
- Managing database schemas (tables, columns, relationships)
67+
- Deploying schema changes to hosted databases
68+
- Querying database schemas and data
69+
- Providing insights about database structure and best practices
70+
"""),
71+
markdown=True,
72+
show_tool_calls=True,
73+
)
74+
75+
# Run the agent
76+
await agent.aprint_response(message, stream=True)
7077

71-
# Run the agent
72-
await agent.aprint_response(message, stream=True)
78+
# Close the MCP connection
79+
await mcp_tools.close()
7380

7481

7582
# Example usage

libs/agno/agno/team/team.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5645,7 +5645,7 @@ def _get_user_message(
56455645
if isinstance(message, str):
56465646
user_message_content = message
56475647
else:
5648-
user_message_content = "\n".join(message)
5648+
user_message_content = "\n".join(str(message))
56495649

56505650
# Add references to user message
56515651
if (

0 commit comments

Comments
 (0)