Skip to main content
Glama

search_mlx_models

Search and list MLX-format LLM models available on Hugging Face using keywords like 'llama' or 'qwen'.

Instructions

Hugging Faceからダウンロード可能なMLXフォーマットのLLMモデルを検索・リストアップします。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_queryNo検索キーワード(例: 'llama', 'qwen')。未指定の場合は人気のMLXモデルを返します。
limitNo取得する最大件数。デフォルトは10。

Implementation Reference

  • Main handler for the search_mlx_models tool. Extracts arguments (search_query, limit), validates them, then uses HfApi.list_models with tag 'mlx' and sort by downloads to fetch results. Runs the blocking HF API call via asyncio.to_thread. Returns a JSON list of model IDs, downloads, and likes.
    @server.call_tool()
    async def handle_call_tool(
        name: str, arguments: dict[str, Any] | None
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """AIエージェントから呼び出されたツールを実際に実行します"""
        if arguments is None and name not in ("list_running_servers", "search_mlx_models", "check_system_environment"):
            raise ValueError("Arguments are required")
    
        if name == "check_system_environment":
            info = process_manager.get_system_info()
            return [types.TextContent(type="text", text=json.dumps(info, indent=2))]
    
        elif name == "check_llm_status":
            port = arguments.get("port")
            if not isinstance(port, int):
                raise ValueError("Port must be an integer")
            
            is_running = process_manager.is_port_in_use(port)
            return [types.TextContent(type="text", text=str(is_running).lower())]
    
        elif name == "list_running_servers":
            servers = process_manager.get_running_servers()
            if not servers:
                return [types.TextContent(type="text", text="No running servers found.")]
            return [types.TextContent(type="text", text=json.dumps(servers, indent=2))]
    
        elif name == "search_mlx_models":
            query = arguments.get("search_query") if arguments else None
            limit = arguments.get("limit", 10) if arguments else 10
    
            if limit is not None and not isinstance(limit, int):
                raise ValueError("limit must be an integer")
            if query is not None and not isinstance(query, str):
                raise ValueError("search_query must be a string")
    
            def _search():
                api = HfApi()
                models = api.list_models(
                    search=query if query else None,
                    tags="mlx",
                    sort="downloads",
                    direction=-1,
                    limit=limit
                )
                results = []
                for m in models:
                    results.append({
                        "modelId": m.id,
                        "downloads": getattr(m, 'downloads', 0),
                        "likes": getattr(m, 'likes', 0)
                    })
                return results
    
            try:
                results = await asyncio.to_thread(_search)
                if not results:
                    return [types.TextContent(type="text", text="No MLX models found.")]
                return [types.TextContent(type="text", text=json.dumps(results, indent=2))]
            except Exception as e:
                return [types.TextContent(type="text", text=f"Error searching models: {str(e)}")]
  • Registration and input schema for search_mlx_models. Defines the tool name, description, and inputSchema with optional 'search_query' (string) and 'limit' (integer, default 10) properties.
    types.Tool(
        name="search_mlx_models",
        description="Hugging Faceからダウンロード可能なMLXフォーマットのLLMモデルを検索・リストアップします。",
        inputSchema={
            "type": "object",
            "properties": {
                "search_query": {
                    "type": "string",
                    "description": "検索キーワード(例: 'llama', 'qwen')。未指定の場合は人気のMLXモデルを返します。"
                },
                "limit": {
                    "type": "integer",
                    "description": "取得する最大件数。デフォルトは10。"
                }
            },
        },
  • Tool registration inside handle_list_tools(). The search_mlx_models tool is listed alongside 7 other tools in the MCP tool registry.
    types.Tool(
        name="search_mlx_models",
        description="Hugging Faceからダウンロード可能なMLXフォーマットのLLMモデルを検索・リストアップします。",
        inputSchema={
            "type": "object",
            "properties": {
                "search_query": {
                    "type": "string",
                    "description": "検索キーワード(例: 'llama', 'qwen')。未指定の場合は人気のMLXモデルを返します。"
                },
                "limit": {
                    "type": "integer",
                    "description": "取得する最大件数。デフォルトは10。"
                }
            },
        },
    ),
  • Special registration: search_mlx_models is exempted from the 'arguments required' check, since both search_query and limit are optional.
    if arguments is None and name not in ("list_running_servers", "search_mlx_models", "check_system_environment"):
        raise ValueError("Arguments are required")
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits such as read-only nature, rate limits, pagination, or result format. The minimal description leaves substantial gaps.

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 short sentence with no irrelevant information, achieving conciseness. However, it may be slightly under-specified for the tool's complexity.

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 the tool's simplicity and full schema coverage, the description is adequate but could mention that the search is read-only and limited to MLX format. It does not explain return values or pagination.

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?

Schema description coverage is 100% and already documents both parameters. The description adds minimal extra value by providing an example for search_query and stating the default for limit, but does not go beyond the schema.

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 searches and lists MLX format LLM models from Hugging Face, which distinguishes it from sibling tools focused on server management and model downloading.

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 over alternatives like download_model, or any prerequisites. Usage context is implied but not explicit.

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/globalpocket/mcp-mlx-launcher'

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