search_documentation
Search Ramp API documentation using natural language queries to find relevant guides, authentication methods, implementation examples, and troubleshooting solutions for developers building integrations.
Instructions
š SMART DOCUMENTATION SEARCH - Finds the most relevant Ramp API documentation for your query.
What this does: ⢠šÆ Detects your intent from natural language queries ⢠š Searches through all Ramp documentation and guides ⢠š§ Reasons about which content is most relevant ⢠š Returns clean, actionable markdown chunks
Perfect for: ⢠Getting started with authentication ⢠Understanding specific API workflows ⢠Finding implementation examples ⢠Troubleshooting integration issues
Usage: Just describe what you're trying to do naturally. Examples: "building an integration", "setting up OAuth", "bill payment workflow", "webhook events"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Your question or what you're trying to accomplish. Use natural language - e.g., 'building an integration', 'OAuth setup', 'bill payments' |
Implementation Reference
- src/tools/search_documentation.py:56-89 (handler)The main handler function that executes the search_documentation tool logic: processes the query, detects intent, finds relevant guides, extracts content, and returns formatted TextContent.async def execute(self, arguments: Dict[str, Any]) -> List[TextContent]: """Search documentation and return most relevant content""" query = arguments.get("query", "").strip() if not query: return [TextContent( type="text", text="ā Please provide a search query describing what you're looking for." )] try: # Step 1: Detect intent from user query detected_cluster = self.knowledge_base.detect_intent(query) # Step 2: Find and rank relevant documentation files relevant_guides = self._find_relevant_guides(query, detected_cluster) if not relevant_guides: return [TextContent( type="text", text=f"ā¹ļø No specific documentation found for '{query}'. Try more specific keywords like 'authentication', 'bill payments', 'webhooks', or 'card management'." )] # Step 3: Extract and return the most relevant content content = self._extract_relevant_content(relevant_guides[0], query, detected_cluster) return [TextContent(type="text", text=content)] except Exception as e: return [TextContent( type="text", text=f"ā Error searching documentation: {str(e)}" )]
- Defines the input schema for the tool, requiring a 'query' string parameter.def input_schema(self) -> Dict[str, Any]: return { "type": "object", "properties": { "query": { "type": "string", "description": "Your question or what you're trying to accomplish. Use natural language - e.g., 'building an integration', 'OAuth setup', 'bill payments'" } }, "required": ["query"] }
- src/server.py:46-51 (registration)Registers the SearchDocumentationTool by instantiating it with the knowledge_base and adding to the server's tools list.tools = [ PingTool(), SearchDocumentationTool(knowledge_base), SubmitFeedbackTool(), GetEndpointSchemaTool(knowledge_base) ]
- src/tools/search_documentation.py:21-23 (registration)Defines the tool name as 'search_documentation' used for registration and invocation.def name(self) -> str: return "search_documentation"
- Helper method to find and rank relevant documentation guides based on query and detected intent cluster.def _find_relevant_guides(self, query: str, detected_cluster: str) -> List[Dict[str, Any]]: """Find and rank relevant documentation files""" relevant_guides = [] # If we detected a cluster, prioritize its guides if detected_cluster and detected_cluster in self.knowledge_base.use_case_clusters: cluster_data = self.knowledge_base.use_case_clusters[detected_cluster] guide_filenames = cluster_data.get("guides", []) for guide_filename in guide_filenames: guide_content = self.knowledge_base._find_guide_by_filename(guide_filename) if guide_content: relevance_score = self._calculate_relevance(query, guide_content, guide_filename) relevant_guides.append({ 'filename': guide_filename, 'content': guide_content, 'cluster': detected_cluster, 'score': relevance_score }) # Also search all guides for keyword matches query_keywords = query.lower().split() for guide_path, guide_obj in self.knowledge_base.guides.items(): if not any(guide['filename'] in guide_path for guide in relevant_guides): relevance_score = self._calculate_relevance(query, guide_obj.content, guide_path) if relevance_score > 0.1: # Only include if somewhat relevant relevant_guides.append({ 'filename': str(guide_path), 'content': guide_obj.content, 'cluster': 'general', 'score': relevance_score }) # Sort by relevance score (highest first) relevant_guides.sort(key=lambda x: x['score'], reverse=True) return relevant_guides