Skip to main content
Glama

Chat with model

chat_with_model

Send chat completion requests to local AI models on Local AI, MLX, or Llama.cpp backends; returns backend JSON or errors when the service is unavailable.

Instructions

Send a chat completion to a local model on Local AI, MLX or Llama.cpp. Use list_models first if you need names. Use ask_frontier for a cloud model. Calls the local OpenAI-compatible /v1/chat/completions endpoint. Not read-only. Returns the backend JSON or an error when the service is down.

Input Schema

NameRequiredDescriptionDefault
modelYesModel name as listed by list_models for that backend.
backendNoInference backend. One of local_ai, mlx, llamacpp. Default local_ai.local_ai
messagesYesChat messages. Each object needs role (system, user or assistant) and content.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv6.2.1

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false and openWorldHint=true, so the description's 'Not read-only' is redundant but consistent. It adds useful behavioral context by naming the local OpenAI-compatible endpoint and noting that errors are returned when the service is down.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is four short sentences, front-loads the core action, then adds routing guidance, endpoint detail, and error behavior. Every sentence carries useful information with no wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With rich annotations, 100% schema description coverage, and an output schema, the description supplies the remaining context an agent needs: local-vs-cloud routing, the endpoint used, and error behavior. Nothing important for correct invocation is missing.

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%, so the schema already documents model, backend, and messages. The description only lightly reinforces parameter meaning by mentioning list_models for names and naming the supported backends, but adds little beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Send a chat completion to a local model' on named backends. It distinguishes the tool from cloud usage by explicitly naming ask_frontier, and from model discovery by naming list_models.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives direct routing guidance: use list_models first if model names are needed, and use ask_frontier for a cloud model. This covers the main alternative an agent would otherwise confuse with this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.