Skip to main content
Glama
KazKozDev
by KazKozDev

Search Tools

search_tools

Find the right editing tool for complex Markdown operations by describing what you need to accomplish with your document.

Instructions

Scalability feature: find the right tool for your complex task among all available tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesDescription of the operation you want to perform

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
toolsNoList of relevant tool names

Implementation Reference

  • Handler logic for the 'search_tools' tool. It extracts the query, fetches all available tools using list_tools(), filters tools whose name or description contains the query (case-insensitive), and returns a CallToolResult with the list of relevant tool names.
    if name == "search_tools":
        query = arguments.get("query", "").lower()
        all_tools = await list_tools()
        relevant = [
            t.name
            for t in all_tools
            if query in t.name or (t.description and query in t.description.lower())
        ]
        return CallToolResult(
            content=[
                TextContent(
                    type="text", text=f"Relevant tools: {', '.join(relevant)}"
                )
            ],
            structuredContent={"tools": relevant},
            isError=False,
        )
  • Input and output schema definition for the 'search_tools' tool, registered within the list_tools() function. Input requires a 'query' string; output provides an array of matching tool names.
    Tool(
        name="search_tools",
        title="Search Tools",
        description="Scalability feature: find the right tool for your complex task among all available tools.",
        inputSchema={
            "type": "object",
            "properties": {
                "query": {
                    "type": "string",
                    "description": "Description of the operation you want to perform",
                    "examples": [
                        "find paragraphs",
                        "replace text",
                        "move section",
                        "delete element",
                        "list files",
                    ],
                }
            },
            "required": ["query"],
            "additionalProperties": False,
        },
        outputSchema={
            "type": "object",
            "properties": {
                "tools": {
                    "type": "array",
                    "description": "List of relevant tool names",
                    "items": {"type": "string"},
                }
            },
        },
    ),
  • Registration of the 'search_tools' tool via the @app.list_tools() decorator on the list_tools() function, which returns a list of all Tool objects including search_tools.
    @app.list_tools()
    async def list_tools() -> list[Tool]:
        """
        Returns the complete list of tools available in the server.
        Adheres to the 2025 Scaling Standard for MCP.
        """
        return [
            # --- SCALING & DISCOVERY (2025 Standard) ---
            Tool(
                name="search_tools",
                title="Search Tools",
                description="Scalability feature: find the right tool for your complex task among all available tools.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "query": {
                            "type": "string",
                            "description": "Description of the operation you want to perform",
                            "examples": [
                                "find paragraphs",
                                "replace text",
                                "move section",
                                "delete element",
                                "list files",
                            ],
                        }
                    },
                    "required": ["query"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "tools": {
                            "type": "array",
                            "description": "List of relevant tool names",
                            "items": {"type": "string"},
                        }
                    },
                },
            ),
            # --- NAVIGATION & STRUCTURE ---
            Tool(
                name="get_document_structure",
                title="Get Document Structure",
                description="Parses the Markdown file and returns a tree of headings and elements. Use this first to navigate.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {
                            "type": "string",
                            "description": "Absolute path to the .md file",
                            "examples": ["/path/to/document.md", "./README.md"],
                        },
                        "depth": {
                            "type": "integer",
                            "description": "Maximum depth of headings to return",
                            "default": 2,
                            "examples": [2, 3, 5],
                        },
                    },
                    "required": ["file_path"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "structure": {
                            "type": "array",
                            "description": "Tree of document elements",
                        }
                    },
                },
            ),
            Tool(
                name="search_text",
                title="Search Text in Document",
                description="Performs a semantic search for text strings and returns their structural paths.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {
                            "type": "string",
                            "examples": ["./document.md", "/path/to/file.md"],
                        },
                        "query": {
                            "type": "string",
                            "description": "String to search for",
                            "examples": ["TODO", "urgent", "deadline"],
                        },
                    },
                    "required": ["file_path", "query"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "results": {
                            "type": "array",
                            "description": "List of matching elements with their paths",
                        }
                    },
                },
            ),
            Tool(
                name="get_context",
                title="Get Element Context",
                description="Returns the target element along with its immediate neighbors (before and after).",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string", "examples": ["./document.md"]},
                        "path": {
                            "type": "string",
                            "description": "Path to the element (e.g., 'Intro > paragraph 1')",
                            "examples": ["Introduction > paragraph 2", "Conclusion"],
                        },
                    },
                    "required": ["file_path", "path"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "target": {"type": "object", "description": "The target element"},
                        "before": {
                            "type": "object",
                            "description": "Element before target",
                        },
                        "after": {"type": "object", "description": "Element after target"},
                    },
                },
            ),
            # --- CONTENT EDITING ---
            Tool(
                name="read_element",
                title="Read Specific Element",
                description="Fetches the full content of a specific block by its path.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string", "examples": ["./document.md"]},
                        "path": {
                            "type": "string",
                            "examples": ["Features > list 1", "Introduction"],
                        },
                    },
                    "required": ["file_path", "path"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "element": {
                            "type": "object",
                            "description": "The requested element",
                        },
                        "content": {"type": "string", "description": "Element content"},
                    },
                },
            ),
            Tool(
                name="replace_content",
                title="Replace Block Content",
                description="Overwrites the content of a specific block. Maintains document structure.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string", "examples": ["./document.md"]},
                        "path": {
                            "type": "string",
                            "examples": [
                                "Introduction > paragraph 1",
                                "Conclusion",
                                "Features > list 2",
                            ],
                        },
                        "new_content": {
                            "type": "string",
                            "examples": ["Updated paragraph text", "New content here"],
                        },
                    },
                    "required": ["file_path", "path", "new_content"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {"success": {"type": "boolean"}},
                },
            ),
            Tool(
                name="insert_element",
                title="Insert New Element",
                description="Inserts a new block (heading, paragraph, etc.) relative to an existing one.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string", "examples": ["./document.md"]},
                        "path": {
                            "type": "string",
                            "description": "Reference path",
                            "examples": ["Introduction", "Features > paragraph 2"],
                        },
                        "element_type": {
                            "type": "string",
                            "enum": [
                                "heading",
                                "paragraph",
                                "list",
                                "code_block",
                                "blockquote",
                            ],
                            "examples": ["paragraph", "heading"],
                        },
                        "content": {
                            "type": "string",
                            "examples": ["New paragraph content", "## New Section"],
                        },
                        "where": {
                            "type": "string",
                            "enum": ["before", "after"],
                            "default": "after",
                            "examples": ["after", "before"],
                        },
                        "heading_level": {
                            "type": "integer",
                            "default": 1,
                            "examples": [1, 2, 3],
                        },
                    },
                    "required": ["file_path", "path", "element_type", "content"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {"success": {"type": "boolean"}},
                },
            ),
            Tool(
                name="move_element",
                title="Move Structural Block",
                description="Moves an element (and its children) to a new location in the document.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string", "examples": ["./document.md"]},
                        "source_path": {
                            "type": "string",
                            "examples": ["Old Section", "Introduction > paragraph 2"],
                        },
                        "target_path": {
                            "type": "string",
                            "examples": ["Conclusion", "Features"],
                        },
                        "where": {
                            "type": "string",
                            "enum": ["before", "after"],
                            "default": "after",
                            "examples": ["after", "before"],
                        },
                    },
                    "required": ["file_path", "source_path", "target_path"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {"success": {"type": "boolean"}},
                },
            ),
            Tool(
                name="delete_element",
                title="Delete Block",
                description="Removes a block from the document.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string", "examples": ["./document.md"]},
                        "path": {
                            "type": "string",
                            "examples": [
                                "Introduction > paragraph 3",
                                "Old Section",
                                "Deprecated > list 1",
                            ],
                        },
                    },
                    "required": ["file_path", "path"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {"success": {"type": "boolean"}},
                },
            ),
            Tool(
                name="update_metadata",
                title="Update YAML Metadata",
                description="Modifies the document's Frontmatter.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {
                            "type": "string",
                            "examples": ["./document.md", "./blog/post.md"],
                        },
                        "metadata": {
                            "type": "object",
                            "examples": [
                                {"status": "published", "tags": ["mcp", "ai"]},
                                {"author": "John Doe", "date": "2025-12-27"},
                            ],
                        },
                    },
                    "required": ["file_path", "metadata"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {"success": {"type": "boolean"}},
                },
            ),
            Tool(
                name="undo",
                title="Undo Last Changes",
                description="Reverts the last N operations on the document.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string", "examples": ["./document.md"]},
                        "count": {"type": "integer", "default": 1, "examples": [1, 2, 5]},
                    },
                    "required": ["file_path"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "success": {"type": "boolean"},
                        "reverted_count": {
                            "type": "integer",
                            "description": "Number of operations reverted",
                        },
                    },
                },
            ),
            # --- FILE SYSTEM ---
            Tool(
                name="list_directory",
                title="List Directory",
                description="Lists files and folders in the workspace.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "path": {
                            "type": "string",
                            "default": ".",
                            "examples": [".", "./docs", "/path/to/directory"],
                        }
                    },
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "items": {
                            "type": "array",
                            "description": "List of directory entries",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "name": {"type": "string"},
                                    "is_dir": {"type": "boolean"},
                                    "size": {"type": "integer"},
                                    "path": {"type": "string"},
                                },
                            },
                        }
                    },
                },
            ),
            Tool(
                name="create_file",
                title="Create File",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "path": {
                            "type": "string",
                            "examples": ["./new_document.md", "./notes/todo.md"],
                        },
                        "content": {
                            "type": "string",
                            "default": "",
                            "examples": ["# New Document\n\nContent here", ""],
                        },
                    },
                    "required": ["path"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "success": {"type": "boolean"},
                        "path": {"type": "string"},
                        "size": {"type": "integer"},
                    },
                },
            ),
            Tool(
                name="create_directory",
                title="Create Directory",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "path": {
                            "type": "string",
                            "examples": ["./new_folder", "./docs/archive"],
                        }
                    },
                    "required": ["path"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "success": {"type": "boolean"},
                        "path": {"type": "string"},
                    },
                },
            ),
            Tool(
                name="delete_item",
                title="Delete File/Folder",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "path": {
                            "type": "string",
                            "examples": ["./old_file.md", "./temp_folder"],
                        }
                    },
                    "required": ["path"],
                    "additionalProperties": False,
                },
                outputSchema={
                    "type": "object",
                    "properties": {
                        "success": {"type": "boolean"},
                        "path": {"type": "string"},
                    },
                },
            ),
        ]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'scalability feature' but doesn't explain what this entails—such as performance characteristics, rate limits, or authentication needs. The description lacks details on how the search works, what the output includes, or any constraints, making it insufficient for a tool with behavioral implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is front-loaded and efficient, with no wasted words. It directly states the tool's purpose without unnecessary elaboration. However, it could be slightly more structured by explicitly mentioning the scope (e.g., 'among sibling tools') to improve clarity without sacrificing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there is an output schema (which reduces the need to describe return values) and high schema coverage, the description is minimally adequate. However, for a search tool with no annotations and behavioral aspects like scalability, it should provide more context on how results are ranked or what 'scalability feature' means. The description is incomplete in addressing these nuances.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'query' parameter well-documented as a string describing the operation. The description adds no additional meaning beyond the schema, such as clarifying search syntax or result relevance. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'find the right tool for your complex task among all available tools,' which specifies the verb 'find' and the resource 'tool.' It distinguishes itself from siblings like 'search_text' by focusing on tool discovery rather than content searching. However, it doesn't explicitly mention that it searches among the sibling tools listed, which could make it slightly less specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't specify scenarios where searching for tools is preferable over directly using known tools like 'list_directory' or 'search_text,' nor does it mention prerequisites or exclusions. This lack of context leaves the agent without clear usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/KazKozDev/markdown-editor-mcp-server'

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