mlx-swift-examples
mlx-swift-examples copied to clipboard
Suggestion: MCP example
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.
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"]
]
]
]
}