Skip to main content
Glama
dstreefkerk

ms-sentinel-mcp-server

by dstreefkerk

tool_docs_get

Retrieve raw markdown documentation from the Microsoft Sentinel MCP server for specific paths to access technical content and implementation details.

Instructions

Return the raw markdown for a given documentation path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Implementation Reference

  • The ToolDocsGetTool class defines and implements the 'tool_docs_get' tool. It includes the name, description, and the core async run() method that extracts the 'path' parameter, validates it, reads the markdown file from the DOC_ROOT directory, and returns the content or an error.
    class ToolDocsGetTool(MCPToolBase):
        """Tool for retrieving the raw markdown for a given documentation path."""
    
        name = "tool_docs_get"
        description = "Return the raw markdown for a given documentation path."
    
        async def run(self, ctx, **kwargs) -> Any:
            """
            Return the raw markdown for a given documentation path.
    
            Args:
                ctx: The tool context (unused).
                **kwargs: Should include:
                    - path (str): Relative path to the markdown doc (as returned by list_docs).
    
            Returns:
                dict: {
                    'content': raw markdown content of the file,
                    'error': error message if file does not exist or is outside the docs directory,
                    'available_docs': list of available docs if file not found
                }
            """
    
            # Defensive: handle string, None, or dict for kwargs
    
            # Extract path parameter using the centralized parameter extraction from MCPToolBase
            path = self._extract_param(kwargs, "path")
    
            # Check if path is a string
            if path is not None and not isinstance(path, str):
                return {"error": "Invalid path type. Expected a string."}
    
            if not path:
                return {"error": "Missing required parameter: path"}
    
            try:
                file = DOC_ROOT / path
                file.resolve().relative_to(DOC_ROOT.resolve())
                if not file.exists():
                    # Suggest available docs
                    available = [
                        str(p.relative_to(DOC_ROOT)) for p in DOC_ROOT.rglob("*.md")
                    ]
                    return {"error": f"Doc not found: {path}", "available_docs": available}
                content = file.read_text(encoding="utf-8")
                return {"content": content}
            except Exception as e:
                return {"error": f"Failed to read doc: {e}"}
  • The register_tools function registers the ToolDocsGetTool (along with related tools) with the MCP server instance by calling its register method.
    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)
  • DOC_ROOT constant defines the base path for tool documentation markdown files, used by the tool handler.
    DOC_ROOT = Path(__file__).parent.parent / "resources" / "tool_docs"

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