Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: The connection issue is most likely caused by an invalid API key. Please ensure you have replaced the placeholder Hello! Thanks for reaching out. I've looked at the code you provided. The most probable reason you are unable to connect to the Tencent Map MCP service is that the To resolve this, please follow these steps:
Once the Let me know if you have any other questions! [1] mcp-tools (gs://adk-knowledge-bucket-cloud-vi-test/adk-docs/docs/tools/mcp-tools.html) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Docs
https://lbs.qq.com/service/MCPServer/MCPServerGuide/userGuide
./adk_agent_samples/mcp_agent/agent.py
import os
from google.adk.agents import LlmAgent
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
from google.adk.tools.mcp_tool.mcp_session_manager import (
SseConnectionParams,
StreamableHTTPConnectionParams,
)
你的腾讯地图 API Key
TENCENT_MAP_API_KEY = "xxxxx" // warn: fill in your key....
腾讯地图 MCP 端点
SSE (Server-Sent Events) 方式
TENCENT_MAP_SSE_URL = (
f"https://mcp.map.qq.com/sse?key={TENCENT_MAP_API_KEY}&format=0"
)
Streamable HTTP 方式
TENCENT_MAP_STREAMABLE_HTTP_URL = (
f"https://mcp.map.qq.com/mcp?key={TENCENT_MAP_API_KEY}&format=0"
)
root_agent = LlmAgent(
model="gemini-2.0-flash",
name="tencent_map_agent", #
instruction="You are a helpful assistant that can answer map-related questions using Tencent Map tools.",
tools=[
# 工具集1: 使用 SSE 方式连接
MCPToolset(
connection_params=SseConnectionParams(
url=TENCENT_MAP_SSE_URL,
timeout=30.0, # 增加连接超时时间
sse_read_timeout=60.0, # 增加读取超时时间
)
),
# 工具集2: 使用 Streamable HTTP 方式连接
MCPToolset(
connection_params=StreamableHTTPConnectionParams(
url=TENCENT_MAP_STREAMABLE_HTTP_URL,
timeout=30.0, # 增加连接超时时间
sse_read_timeout=60.0, # 增加读取超时时间
)
),
],
)
I cannnot connect both ways
Beta Was this translation helpful? Give feedback.
All reactions