-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_client.py
46 lines (40 loc) · 1.63 KB
/
test_client.py
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
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def test_linkedin_tools():
server_params = StdioServerParameters(
command="python",
args=["server.py"]
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# List available tools
response = await session.list_tools()
print("\nAvailable tools:", [tool.name for tool in response.tools])
# Test profile lookup
try:
profile = await session.call_tool(
"get_profile_details",
{
"linkedin_url": "https://www.linkedin.com/in/davidstubbss",
"include_company_details": True
}
)
print("\nProfile:", profile.content)
except Exception as e:
print("\nError fetching profile:", str(e))
# Test activities lookup
try:
activities = await session.call_tool(
"get_contact_activities",
{
"linkedin_url": "https://www.linkedin.com/in/davidstubbss",
"pages": 1
}
)
print("\nActivities:", activities.content)
except Exception as e:
print("\nError fetching activities:", str(e))
if __name__ == "__main__":
asyncio.run(test_linkedin_tools())