search_all_docs
Search across all Prisma Cloud documentation sites to find answers to your questions about the platform.
Instructions
Search across all Prisma Cloud documentation sites.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- src/main.py:207-211 (handler)The handler function for the 'search_all_docs' MCP tool. It is decorated with @mcp.tool() for registration and executes the core logic by delegating to the indexer's search_docs method, serializing results to JSON.@mcp.tool() async def search_all_docs(query: str) -> str: """Search across all Prisma Cloud documentation sites.""" results = await indexer.search_docs(query) return json.dumps(results, indent=2)
- server.py:203-207 (handler)Identical handler function for the 'search_all_docs' MCP tool in server.py variant.@mcp.tool() async def search_all_docs(query: str) -> str: """Search across all Prisma Cloud documentation sites.""" results = await indexer.search_docs(query) return json.dumps(results, indent=2)
- src/main.py:108-160 (helper)Core search logic in DocumentationIndexer.search_docs method, called by the tool handler. Performs relevance scoring on cached pages and returns top 10 results.async def search_docs(self, query: str, site: str = None) -> List[Dict]: """Search indexed documentation""" if not self.cached_pages: return [] query_lower = query.lower() results = [] for url, page in self.cached_pages.items(): # Filter by site if specified if site and page.site != site: continue # Calculate relevance score score = 0 title_lower = page.title.lower() content_lower = page.content.lower() # Higher score for title matches if query_lower in title_lower: score += 10 # Even higher for exact title matches if query_lower == title_lower: score += 20 # Score for content matches content_matches = content_lower.count(query_lower) score += content_matches * 2 # Score for partial word matches in title query_words = query_lower.split() for word in query_words: if word in title_lower: score += 5 if word in content_lower: score += 1 if score > 0: # Extract snippet around first match snippet = self._extract_snippet(page.content, query, max_length=200) results.append({ 'title': page.title, 'url': page.url, 'site': page.site, 'snippet': snippet, 'score': score }) # Sort by relevance score (highest first) and limit results results.sort(key=lambda x: x['score'], reverse=True) return results[:10]
- server.py:104-156 (helper)Core search logic in DocumentationIndexer.search_docs method (identical to src/main.py).async def search_docs(self, query: str, site: str = None) -> List[Dict]: """Search indexed documentation""" if not self.cached_pages: return [] query_lower = query.lower() results = [] for url, page in self.cached_pages.items(): # Filter by site if specified if site and page.site != site: continue # Calculate relevance score score = 0 title_lower = page.title.lower() content_lower = page.content.lower() # Higher score for title matches if query_lower in title_lower: score += 10 # Even higher for exact title matches if query_lower == title_lower: score += 20 # Score for content matches content_matches = content_lower.count(query_lower) score += content_matches * 2 # Score for partial word matches in title query_words = query_lower.split() for word in query_words: if word in title_lower: score += 5 if word in content_lower: score += 1 if score > 0: # Extract snippet around first match snippet = self._extract_snippet(page.content, query, max_length=200) results.append({ 'title': page.title, 'url': page.url, 'site': page.site, 'snippet': snippet, 'score': score }) # Sort by relevance score (highest first) and limit results results.sort(key=lambda x: x['score'], reverse=True) return results[:10]
- src/main.py:28-29 (helper)The DocumentationIndexer class initialization, defining caches and base URLs used by the search functionality.class DocumentationIndexer: