mlx-swift-examples icon indicating copy to clipboard operation
mlx-swift-examples copied to clipboard

Suggestion: MCP example

Open mobile-appz opened this issue 8 months ago • 1 comments

Is it possible to provide an example with MLX working with an MCP server that runs locally. There are several Swift implementations of MCP out there (seemingly lacking actual working examples, which is what is so good about this repository) but it would be great to have an end to end example with MLX. Eg a native iOS app incorporating MLX and MCP server connection to google maps API. The user could enter a prompt in natural language that queries the Google maps API and the results are returned to the user in natural language. The user could say "how do I get to x and how long does it take" and the app provides an answer. If any such examples already exist I'd be happy to hear about them.

mobile-appz avatar Mar 16 '25 05:03 mobile-appz

you can use the param tools let input = try await context.processor.prepare(input: .init(messages: self.messages,tools:toolService.getAllToolSpecs() ))

var toolSpec: [String: any Sendable] {
    return [
        "type": "function",
        "function": [
            "name": name,
            "description": "Furgent Enable AI to control your browser",
            "parameters": [
                "type": "object",
                "properties": [
                    "prompt": [
                        "type": "string",
                        "description": "浏览器任务指令,如'打开GitHub并截图'"
                    ]
                ],
                "required": ["prompt"]
            ]
        ]
    ]
}

hsduren avatar Apr 02 '25 03:04 hsduren