Concept 6 · Google · AI Community 2026What is MCP (Client Side)?
05b and 05d · Art #5b and #5d

sse_client(MCP_SSE_URL): connects to the local MCP server via HTTP/SSE streams (read for incoming events, write for outgoing requests).

ClientSession(read, write): creates an active MCP client session over those streams.

await session.initialize(): performs the initial MCP protocol handshake to negotiate capabilities.

session.call_tool(...): dispatches a remote procedure call (RPC) to execute the tool named "find_soste_by_fuel_and_location" on the target MCP server.

return str(result.content): formats the tool output into a text string so the LLM agent can parse it and formulate its final answer to the user.

subagents/soste_search_agent.py (Branch 05d)
MCP_PORT = os.getenv("MCP_PORT", "8002")
MCP_SSE_URL = f"http://127.0.0.1:{MCP_PORT}/sse"
# Define the async tool function that ADK executes
# when SosteSearchAgent invokes it
async def get_mcp_soste_session(
latitude: float,
longitude: float,
fuel_type: Optional[str] = None,
) -> str:
"""..... """
async with sse_client(MCP_SSE_URL) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# Arguments forwarded to the MCP tool
# 'find_soste_by_fuel_and_location'
args = {
"latitude": latitude,
"longitude": longitude,
}
if fuel_type:
args["fuel_type"] = fuel_type
result = await session.call_tool(
"find_soste_by_fuel_and_location", arguments=args
)
return str(result.content)