A chat model can ask for data that lives outside its conversation. A TypeScript plugin gives LM Studio a tool the model can call and sends the tool's result back to the chat.
A tools provider defines the arguments a model can send and the code that runs for each call. The market-hours provider uses a table of fictional closing times, so a lookup needs no external service.
Local development requires LM Studio desktop, its bundled lms command, and a chat with a tool-capable model such as Qwen2.5 1.5B Instruct. LM Studio provides the Node.js runtime for plugins.
Steps to create a plugin for LM Studio:
- Create manifest.json in a new project folder named market-hours.
- manifest.json
{ "type": "plugin", "runner": "node", "owner": "local", "name": "market-hours", "revision": 1 }
The manifest gives LM Studio the plugin's name and selects its Node.js runner.
- Create package.json beside manifest.json.
- package.json
{ "name": "lms-plugin-market-hours", "version": "1.0.0", "private": true, "dependencies": { "@lmstudio/sdk": "1.4.0", "zod": "3.24.1" } }
The SDK supplies LM Studio's plugin and tool APIs. Zod limits the tool's input to the market names it can look up.
- Create src/toolsProvider.ts in the project folder.
- src/toolsProvider.ts
import { tool } from "@lmstudio/sdk"; import { z } from "zod"; const hours = { harbor: "17:40 UTC", upland: "19:25 UTC", }; export async function toolsProvider() { return [ tool({ name: "lookup_market_hours", description: "Return the closing time of a fictional market.", parameters: { market: z.enum(["harbor", "upland"]) }, implementation: async ({ market }) => ({ market, closesAt: hours[market] }), }), ]; }
The market argument accepts harbor or upland. The implementation uses that argument as the lookup key and returns the market name with its closing time.
- Create src/index.ts to register the tools provider.
- src/index.ts
import { type PluginContext } from "@lmstudio/sdk"; import { toolsProvider } from "./toolsProvider"; export async function main(context: PluginContext) { context.withToolsProvider(toolsProvider); }
LM Studio calls main when the plugin starts. withToolsProvider makes the provider's tools available when the plugin is enabled in a chat.
- Run the development session from the market-hours folder with LM Studio open.
lms dev
lms dev installs dependencies, builds the plugin, and rebuilds it when files change. A completed build displays build finished and Register with LM Studio in the terminal. The plugin stays available while the command is running. LM Studio's CLI documentation labels the feature beta.
- Open Integrations with the hammer icon beside the chat message box.

- Enable local/market-hours with its switch in Integrations.
The market-hours chip beside the model name shows that the development plugin is active for this chat.
- Enter Use lookup_market_hours for harbor. What is its closing time? in the message box.

- Send the message with the upward-arrow button.

- Check that the call requests lookup_market_hours from dev/local/market-hours with {"market":"harbor"} under Arguments.
Proceed runs the plugin code for the displayed arguments. A different plugin, tool, or market is a reason to deny the request.
- Click Proceed once with both Always allow boxes clear.
Future calls still require their own approval when both options stay clear.
- Expand the completed lookup_market_hours call in the chat.

- Expand Result beneath the call.

- Confirm that the model's reply reports the closing time displayed under Result.
For harbor the tool returns "closesAt": "17:40 UTC". The reply can express that as 5:40 PM (UTC). A reply without the matching tool result does not show that the plugin ran.