-
-
Notifications
You must be signed in to change notification settings - Fork 984
Expand file tree
/
Copy pathmcp_with_local_tools.py
More file actions
50 lines (45 loc) · 1.35 KB
/
Copy pathmcp_with_local_tools.py
File metadata and controls
50 lines (45 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from swarms import Agent
tools = [
{
"type": "function",
"function": {
"name": "add_numbers",
"description": "Add two numbers together and return the result.",
"parameters": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the operation to perform.",
},
"a": {
"type": "integer",
"description": "The first number to add.",
},
"b": {
"type": "integer",
"description": "The second number to add.",
},
},
"required": [
"name",
"a",
"b",
],
},
},
}
]
# Initialize the agent
agent = Agent(
agent_name="Financial-Analysis-Agent",
agent_description="Personal finance advisor agent",
max_loops=2,
tools_list_dictionary=tools,
output_type="final",
mcp_url="http://localhost:8000/mcp",
)
out = agent.run(
"Use the multiply tool to multiply 3 and 4 together. Look at the tools available to you.",
)
print(agent.short_memory.get_str())