Skip to main content
Glama
dstreefkerk

ms-sentinel-mcp-server

by dstreefkerk

tool_docs_search

Search Microsoft Sentinel documentation to find relevant information and resources using full-text queries.

Instructions

Full-text search across documentation; returns matching paths.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Implementation Reference

  • Implements the core logic of tool_docs_search: performs case-insensitive regex search on all documentation .md files, collects matching paths up to optional limit k, returns list of hits or error.
    async def run(self, ctx, **kwargs) -> Any: """ Full-text search across documentation; returns matching paths. Args: ctx: The tool context (unused). **kwargs: Should include: - query (str): Regex or text to search for in docs. - k (int, optional): Max number of results to return (default 10). Returns: dict: { 'hits': list of relative doc paths containing a match, 'error': error message if search fails } """ # Defensive: handle string, None, or dict for kwargs # Extract parameters using the centralized parameter extraction from MCPToolBase query = self._extract_param(kwargs, "query") k = self._extract_param(kwargs, "k") if not query: return {"error": "Missing required parameter: query"} try: candidates = [str(p.relative_to(DOC_ROOT)) for p in DOC_ROOT.rglob("*.md")] pat = re.compile(query, re.I) hits = [] for p in candidates: content = (DOC_ROOT / p).read_text(encoding="utf-8") if pat.search(content): hits.append(p) if k and len(hits) >= int(k): break return {"hits": hits} except Exception as e: return {"error": f"Failed to search docs: {e}"}
  • Class definition with tool name, description, and class docstring defining the tool's purpose and schema basis for MCP integration.
    class ToolDocsSearchTool(MCPToolBase): """Tool for full-text search across documentation; returns matching paths.""" name = "tool_docs_search" description = "Full-text search across documentation; returns matching paths."
  • Registers the ToolDocsSearchTool instance with the MCP server via classmethod register.
    def register_tools(mcp): """Register all documentation tools with the given MCP server instance.""" ToolDocsListTool.register(mcp) ToolDocsGetTool.register(mcp) ToolDocsSearchTool.register(mcp) LLMInstructionsGetTool.register(mcp)
  • server.py:236-238 (registration)
    Top-level auto-registration loader that imports all modules in tools/ directory and invokes their register_tools functions, including tool_docs_tools.py.
    if os.path.exists(tools_dir): tools = load_components(mcp, tools_dir, "register_tools") logger.info("Auto-registered %d tool modules", len(tools))

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dstreefkerk/ms-sentinel-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server