Skip to main content
Glama
dstreefkerk

ms-sentinel-mcp-server

by dstreefkerk

markdown_templates_list

Browse available markdown templates with descriptions to streamline documentation creation for Microsoft Sentinel security operations.

Instructions

List available markdown templates and their descriptions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Implementation Reference

  • The async run method implements the core logic of the markdown_templates_list tool. It scans the markdown_templates directory, reads each .md file, extracts the first line as description if it starts with '#', constructs template info with name, uri, description, and full content, and returns a list of templates or an error.
    async def run(self, ctx, **kwargs) -> Any: """ List available markdown templates and their descriptions. Args: ctx: The context object (unused). **kwargs: Optional arguments (unused). Returns: dict: A dictionary containing a list of templates (with name, uri, description, and content), or an error message if the directory cannot be read. """ if isinstance(kwargs, str): try: kwargs = json.loads(kwargs) except Exception: kwargs = {} elif kwargs is None: kwargs = {} elif not isinstance(kwargs, dict): kwargs = dict(kwargs) try: if not TEMPLATE_DIR.exists() or not TEMPLATE_DIR.is_dir(): return { "error": f"Markdown templates directory does not exist: {TEMPLATE_DIR}" } templates = [] for fname in os.listdir(TEMPLATE_DIR): if fname.endswith(".md"): template_name = os.path.splitext(fname)[0] path = TEMPLATE_DIR / fname try: with open(path, encoding="utf-8") as f: first_line = f.readline().strip() f.seek(0) content = f.read() except Exception as file_exc: self.logger.error( "Failed to read template %s: %s", fname, file_exc ) continue templates.append( { "name": template_name, "uri": f"markdown://templates/{template_name}", "description": ( first_line if first_line.startswith("#") else "Markdown template" ), "content": content, } ) return {"templates": templates} except Exception as e: self.logger.error("Failed to list markdown templates: %s", e) return {"error": f"Failed to list markdown templates: {e}"}
  • Class definition including name, description, and docstring that define the tool's schema and metadata. Inherits from MCPToolBase, which likely provides standard input/output handling. No specific input parameters required.
    class MarkdownTemplatesListTool(MCPToolBase): """ Tool for listing available markdown templates and their descriptions. """ name = "markdown_templates_list" description = "List available markdown templates and their descriptions."
  • The register_tools function registers the MarkdownTemplatesListTool (and related tool) with the MCP server by calling the class register method.
    def register_tools(mcp): """ Register the markdown templates tools with the MCP server. Args: mcp: The MCP server or registry to register the tools with. """ MarkdownTemplatesListTool.register(mcp) MarkdownTemplateGetTool.register(mcp)

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