Skip to main content
Glama
StepanCooleague

file-finder-mcp

search-files

Search for files in your filesystem using path fragments to locate documents quickly. Specify a directory and query to find files by name or path, returning metadata like size and creation date.

Instructions

Поиск файлов по фрагменту пути

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesФрагмент пути для поиска
directoryNoКаталог для поиска/

Implementation Reference

  • Handler for tool calls; specifically handles 'search-files' by extracting arguments and calling search_files function.
    @server.call_tool() async def handle_call_tool( name: str, arguments: dict | None ) -> list[types.TextContent]: """ Обрабатывает выполнение инструментов. """ if name != "search-files": raise ValueError(f"Неизвестный инструмент: {name}") if not arguments or "query" not in arguments: raise ValueError("Отсутствует обязательный параметр 'query'") query = arguments["query"] directory = arguments.get("directory", "/") result = search_files(query, directory) return [ types.TextContent( type="text", text=result, ) ]
  • Input schema definition for the 'search-files' tool.
    inputSchema={ "type": "object", "properties": { "query": {"type": "string", "description": "Фрагмент пути для поиска"}, "directory": {"type": "string", "description": "Каталог для поиска", "default": "/"}, }, "required": ["query"], },
  • Tool registration in the list_tools response, including name, description, and schema.
    types.Tool( name="search-files", description="Поиск файлов по фрагменту пути", inputSchema={ "type": "object", "properties": { "query": {"type": "string", "description": "Фрагмент пути для поиска"}, "directory": {"type": "string", "description": "Каталог для поиска", "default": "/"}, }, "required": ["query"], }, )
  • Helper function that performs the actual file search using os.walk, collects file stats, and returns JSON string.
    def search_files(query: str, directory: str) -> str: """ Выполняет поиск файлов в заданном каталоге. Возвращает результат в формате JSON. """ matches = [] for root, _, files in os.walk(directory): for file in files: if query in file: file_path = os.path.join(root, file) try: stats = os.stat(file_path) matches.append({ "name": file, "path": file_path, "size": stats.st_size, "created": datetime.fromtimestamp(stats.st_ctime).isoformat(), }) except Exception: continue return json.dumps({"files": matches}, indent=2)

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/StepanCooleague/file-finder-mcp'

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