This topic was automatically generated from Slack. You can find the original thread here.
Hi Guys,
I’m currently integrating one of your MCP tools (for example, google_calendar) and have multiple accounts connected for the same app.
I’m passing all the required headers in my request, including:
• x-pd-project-id
• x-pd-environment
• x-pd-external-user-id
• x-pd-app-slug
• x-pd-tool-mode
• x-pd-account-id
• Authorization
Additionally, I tried passing the accountId as a query parameter in the request URL as follows:
However, the response always seems to come from the latest connected account instead of the specific account ID I’m trying to target.
Could you please confirm:
Whether the accountId parameter is supported when calling the MCP tool endpoint directly?
If so, should it be passed in the query string, headers, or request body?
Is there any specific format or configuration needed to select a particular connected account?
I’ve already verified that both accounts are linked and accessible under the same external user.
Please someone help me to figure out this issue !
Btw in the future, it only slows down our team’s ability to help out when you post the same question in 3 different channels — we’ll see it, regardless of which channel you post a question in :skin-tone-2:
async def call_google_calendar_tool(tool_name: str, arguments: dict = None, account_id: str = None):
"""Call a specific Google Calendar MCP tool
Args:
tool_name: Name of the MCP tool to call
arguments: Dictionary of arguments to pass to the tool
account_id: Optional account ID (authProvisionId) to use for this call.
If not provided, Pipedream will use the most recently created account.
Example: "apn_x7hXoMr" or "apn_KAhXr0w"
"""
try:
# Get access token from Pipedream SDK
access_token = pd.raw_access_token
# Construct server URL for Google Calendar
server_url = f"{MCP_SERVER_URL}/{EXTERNAL_USER_ID}/{APP_SLUG}"
# Configure MCP client with authentication headers
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": PIPEDREAM_PROJECT_ID,
"x-pd-environment": PIPEDREAM_ENVIRONMENT,
"x-pd-external-user-id": EXTERNAL_USER_ID,
"x-pd-app-slug": APP_SLUG,
"x-pd-tool-mode": "tools-only"
}
# Add account ID header if specified
if account_id:
headers["x-pd-account-id"] = account_id
print(f"Using specific account: {account_id}")
# Create MCP client connection
async with streamablehttp_client(server_url, headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
# Call the specific tool
print(f"Calling tool: {tool_name}")
print(f"Arguments: {json.dumps(arguments, indent=2)}")
result = await session.call_tool(tool_name, arguments or {})
print(f"--------{result}")
print(f"Tool call successful!")
print(f"Result: {json.dumps(result.content, indent=2)}")
return result
except Exception as e:
print(f"Error calling tool {tool_name}: {e}")
return None
what happening is
i have connected 2 accounts with google_calendar
and i tried to pass the account_id in headers also in query parameters as well
but its taking latest connected account_id while calling the tool
i am expecting this to use the provided account_id to interact with respective app
yes i am sure about the implementation at our end
other things are working fine and integrated in our platform as well
please keep me posted on the same if the bugs get resolved