LMS. - LM Studio Interface

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > LMS. - LM-Studio Commands >

LMS. - LM Studio Interface

LMS.AskMCP - Autonomous Agent Query

Previous Top Next


MiniRobotLanguage (MRL)

 

LMS.Ask MCP - Command

Agent Query with Tool Use & Vision

 

Intention

 

This command transforms LM Studio into an autonomous agent. It allows the LLM to use tools (via an MCP Server) and see images to answer complex queries.

 

Unlike standard queries, this command delegates the "Agent Loop" to the server. The LLM will:

  Analyze your text prompt and optional image.

  Execute Tools automatically (e.g., reading files, checking databases) if needed.

  Synthesize the final answer based on tool results and visual input.

 

Syntax

 

LMS.Ask MCP|P1|[P2]|[P3]|[P4]|[P5]|[P6]

 

Parameter Explanation

 

P1 - (Required) The text prompt. Example: "Look at this image and save a description to a file."

P2 - (Optional) Allowed Tools. A comma-separated list of tool names. If empty or "*", ALL tools on the server are allowed.

P3 - (Optional) Return Variable. The variable to store the final answer. If omitted, the result is copied to the clipboard.

P4 - (Optional) Image Path. Full path to an image file for vision-capable models.

P5 - (Optional) Server Label. Overrides the default MCP server label.

P6 - (Optional) Server URL. Overrides the default MCP server URL (e.g., "http://localhost:5555/sse").

 

Example

 

'**********************************************

' LMS.askmcp - Autonomous Agent Examples

'**********************************************

'

' 1. Basic: Allow ALL tools, copy result to clipboard

LMS.askmcp|"Check system logs for errors."

'

' 2. Vision Agent: Analyze image and use a file tool

$$PRM = "Describe this chart and save the summary to 'report.txt'."

$$IMG = "C:\data\chart.png"

LMS.askmcp|$$PRM||$$RES|$$IMG

'

' 3. Full Config: Restricted tools and custom server

LMS.askmcp|"Query DB"|"db_read"|$$RES||"DB-Server"|"http://localhost:9000/sse"

 

Remarks

 

Requirements: This command requires the "Remote MCP" feature enabled in LM Studio settings. An MCP server must be running.

 

Timeouts: Agentic tasks can take longer than simple chat. Use LMS.settimeout to increase the wait time if needed (default is usually sufficient).

 

See also:

 

    LMS.askex - Extended Query

    LMS.setsystemprompt - Set Agent Persona