ask_bridging
Get answers about Arbitrum bridging and cross-chain messaging patterns with optional code examples for implementation guidance.
Instructions
Answer questions about Arbitrum bridging and cross-chain messaging patterns.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| question | Yes | Question about Arbitrum bridging or messaging | |
| include_code_example | No | Include a code example in the answer if relevant |
Implementation Reference
- src/mcp/tools/ask_bridging.py:119-232 (handler)The 'execute' method of AskBridgingTool handles the core logic for answering bridging questions, using a knowledge base and optional RAG context.
def execute(self, **kwargs) -> dict[str, Any]: """Answer a bridging question.""" question = kwargs.get("question", "").strip() include_code = kwargs.get("include_code_example", False) if not question: return {"error": "Question is required and cannot be empty"} # Normalize question q_lower = question.lower() # Try to match against knowledge base answer_parts = [] relevant_topics = [] # Check for ETH-related questions if "eth" in q_lower and ("deposit" in q_lower or "bridge" in q_lower or "withdraw" in q_lower): if "withdraw" in q_lower or ("l1" in q_lower and "from l2" in q_lower): relevant_topics.append("eth_withdraw") else: relevant_topics.append("eth_deposit") # Check for token/ERC20 questions if "token" in q_lower or "erc20" in q_lower: if "withdraw" in q_lower: relevant_topics.append("erc20_withdraw") else: relevant_topics.append("erc20_deposit") # Check for retryable ticket questions if "retryable" in q_lower or "ticket" in q_lower: relevant_topics.append("retryable_tickets") # Check for messaging questions if "message" in q_lower or "messaging" in q_lower: if "l2 to l1" in q_lower or "l2->l1" in q_lower or "withdraw" in q_lower: relevant_topics.append("l2_to_l1_messaging") else: relevant_topics.append("l1_to_l2_messaging") # Check for L3/Orbit questions if "l3" in q_lower or "orbit" in q_lower: relevant_topics.append("l1_l3_bridging") # Check for gas token questions if "gas token" in q_lower or "custom gas" in q_lower: relevant_topics.append("custom_gas_token") # Check for timing questions if "how long" in q_lower or "time" in q_lower or "when" in q_lower: if "withdraw" in q_lower: relevant_topics.extend(["eth_withdraw", "l2_to_l1_messaging"]) else: relevant_topics.append("eth_deposit") # Build answer from relevant topics if relevant_topics: for topic in set(relevant_topics): if topic in BRIDGING_KNOWLEDGE: info = BRIDGING_KNOWLEDGE[topic] answer_parts.append(f"## {topic.replace('_', ' ').title()}") for key, value in info.items(): if isinstance(value, list): answer_parts.append(f"**{key.replace('_', ' ').title()}:**") for item in value: answer_parts.append(f" - {item}") else: answer_parts.append(f"**{key.replace('_', ' ').title()}:** {value}") answer_parts.append("") # Try RAG context if available rag_context = "" if self.context_tool: try: # Use execute() method with custom boosting for bridging/SDK content ctx_result = self.context_tool.execute( query=question, n_results=3, rerank=True, category_boosts={ "arbitrum_docs": 1.3, "arbitrum_sdk": 1.5, "orbit_sdk": 1.0, "stylus": 0.8, }, ) if ctx_result.get("contexts"): rag_context = "\n\n".join( c.get("content", "") for c in ctx_result["contexts"][:2] ) except Exception: pass # RAG is optional # Build final answer if answer_parts: answer = "\n".join(answer_parts) else: # Generic answer for unmatched questions answer = self._get_generic_answer(question) result = { "answer": answer, "topics": list(set(relevant_topics)) if relevant_topics else ["general"], "references": self._get_references(relevant_topics), } if include_code: result["code_example"] = self._get_code_example(relevant_topics) if rag_context: result["additional_context"] = rag_context[:1000] return result - src/mcp/server.py:885-885 (registration)Registration of the ask_bridging tool in the MCP server.
"ask_bridging": AskBridgingTool(context_tool=self.context_tool), - src/mcp/tools/ask_bridging.py:98-112 (schema)Input schema for the ask_bridging tool.
input_schema = { "type": "object", "properties": { "question": { "type": "string", "description": "Question about Arbitrum bridging or messaging", }, "include_code_example": { "type": "boolean", "description": "Include a code example in the answer if relevant", "default": False, }, }, "required": ["question"], }