Skip to main content
Glama

Chat with LibreModel

chat

Chat with LibreModel (Gigi) through Claude Desktop to interact with local LLM instances using configurable sampling parameters for conversation control.

Instructions

Have a conversation with LibreModel (Gigi)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesYour message to LibreModel
temperatureNoSampling temperature (0.0-2.0)
max_tokensNoMaximum tokens to generate
top_pNoNucleus sampling parameter
top_kNoTop-k sampling parameter
system_promptNoOptional system prompt to prefix the conversation

Implementation Reference

  • Handler function for the 'chat' tool that invokes callLlamaServer with user parameters and formats the response as MCP content.
    }, async (args) => {
      try {
        const response = await this.callLlamaServer({
          message: args.message,
          temperature: args.temperature || this.config.defaultTemperature,
          max_tokens: args.max_tokens || this.config.defaultMaxTokens,
          top_p: args.top_p || this.config.defaultTopP,
          top_k: args.top_k || this.config.defaultTopK,
          system_prompt: args.system_prompt || ""
        });
    
        return {
          content: [
            {
              type: "text",
              text: `**LibreModel (Gigi) responds:**\n\n${response.content}\n\n---\n*Tokens: ${response.tokens_predicted} | Model: ${response.model || "LibreModel"}*`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text", 
              text: `**Error communicating with LibreModel:**\n${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    });
  • Zod input schema defining parameters for the 'chat' tool.
    inputSchema: {
      message: z.string().describe("Your message to LibreModel"),
      temperature: z.number().min(0.0).max(2.0).default(this.config.defaultTemperature).describe("Sampling temperature (0.0-2.0)"),
      max_tokens: z.number().min(1).max(2048).default(this.config.defaultMaxTokens).describe("Maximum tokens to generate"),
      top_p: z.number().min(0.0).max(1.0).default(this.config.defaultTopP).describe("Nucleus sampling parameter"),
      top_k: z.number().min(1).default(this.config.defaultTopK).describe("Top-k sampling parameter"),
      system_prompt: z.string().default("").describe("Optional system prompt to prefix the conversation")
    }
  • src/index.ts:68-109 (registration)
    Registration of the 'chat' tool on the MCP server, including title, description, schema, and handler.
    this.server.registerTool("chat", {
      title: "Chat with LibreModel",
      description: "Have a conversation with LibreModel (Gigi)",
      inputSchema: {
        message: z.string().describe("Your message to LibreModel"),
        temperature: z.number().min(0.0).max(2.0).default(this.config.defaultTemperature).describe("Sampling temperature (0.0-2.0)"),
        max_tokens: z.number().min(1).max(2048).default(this.config.defaultMaxTokens).describe("Maximum tokens to generate"),
        top_p: z.number().min(0.0).max(1.0).default(this.config.defaultTopP).describe("Nucleus sampling parameter"),
        top_k: z.number().min(1).default(this.config.defaultTopK).describe("Top-k sampling parameter"),
        system_prompt: z.string().default("").describe("Optional system prompt to prefix the conversation")
      }
    }, async (args) => {
      try {
        const response = await this.callLlamaServer({
          message: args.message,
          temperature: args.temperature || this.config.defaultTemperature,
          max_tokens: args.max_tokens || this.config.defaultMaxTokens,
          top_p: args.top_p || this.config.defaultTopP,
          top_k: args.top_k || this.config.defaultTopK,
          system_prompt: args.system_prompt || ""
        });
    
        return {
          content: [
            {
              type: "text",
              text: `**LibreModel (Gigi) responds:**\n\n${response.content}\n\n---\n*Tokens: ${response.tokens_predicted} | Model: ${response.model || "LibreModel"}*`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text", 
              text: `**Error communicating with LibreModel:**\n${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    });
  • Helper method that constructs the prompt and makes the HTTP POST request to the llama-server /completion endpoint, used by the chat handler.
    private async callLlamaServer(params: {
      message: string;
      temperature: number;
      max_tokens: number;
      top_p: number;
      top_k: number;
      system_prompt: string;
    }): Promise<LlamaCompletionResponse> {
      const prompt = params.system_prompt 
        ? `${params.system_prompt}\n\nHuman: ${params.message}\n\nAssistant:`
        : `Human: ${params.message}\n\nAssistant:`;
    
      const requestBody: LlamaCompletionRequest = {
        prompt,
        temperature: params.temperature,
        n_predict: params.max_tokens,
        top_p: params.top_p,
        top_k: params.top_k,
        stop: this.config.stopSequences,
        stream: false
      };
    
      const response = await fetch(`${this.config.url}/completion`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json"
        },
        body: JSON.stringify(requestBody)
      });
    
      if (!response.ok) {
        throw new Error(`HTTP ${response.status}: ${response.statusText}`);
      }
    
      const data = await response.json() as LlamaCompletionResponse;
      
      if (!data.content) {
        throw new Error("No content in response from llama-server");
      }
    
      return data;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It mentions 'conversation' but doesn't describe response format, rate limits, authentication needs, conversation state management, or potential side effects. For a chat tool with zero annotation coverage, this leaves significant behavioral gaps.

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 extremely concise at just 5 words ('Have a conversation with LibreModel (Gigi)'). It's front-loaded with the core purpose and contains no wasted words or unnecessary elaboration.

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

Completeness2/5

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

For a chat tool with 6 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns, how conversations are structured, whether there's session management, or any behavioral characteristics. The agent would need to guess about important operational aspects.

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?

The input schema has 100% description coverage, so all parameters are documented in the schema. The tool description adds no parameter-specific information beyond what's in the schema. According to the rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

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

Purpose4/5

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

The description clearly states the tool's purpose as 'Have a conversation with LibreModel (Gigi)', which is a specific verb (chat/converse) with a resource (LibreModel/Gigi). However, it doesn't distinguish this tool from potential alternatives like 'quick_test' or 'health_check' that might also interact with the model, so it lacks sibling differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus the sibling tools 'health_check' or 'quick_test'. There's no mention of appropriate contexts, prerequisites, or exclusions. The agent must infer usage from the tool name alone.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/openconstruct/llama-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server