mcp-llm mcp

v1.0.0 · MCP Tool · ai · registry.pascalai.org

Call any configured LLM provider for text completion, structured JSON output or streaming. Uses MakerAI TPAIProviderRouter with multi-provider routing strategies (first, round_robin, cheapest, fastest, fallback).

llmcompletionaigptclaudegeneration

MakerAI Pipeline

Input Parameters

ParameterTypeDescription
promptrequired string The user prompt or full conversation to send to the LLM.
systemoptional string System prompt to set the assistant's behavior and persona.
modeloptional string Model identifier. Examples: 'claude-sonnet-4-6', 'gpt-4o', 'gemini-2.0-flash', 'llama3.2' (Ollama). Leave empty to use router default.
provideroptional string LLM provider. 'auto' uses the MakerAI router strategy. Default: 'auto'. One of: anthropic, openai, google, ollama, auto. Default: auto.
routing_strategyoptional string MakerAI provider routing strategy when provider='auto'. Default: 'first'. One of: first, round_robin, cheapest, fastest, fallback. Default: first.
temperatureoptional number Sampling temperature (0.0–2.0). Default: 0.7. Default: 0.7.
max_tokensoptional integer Maximum tokens in the response. Default: 2048. Default: 2048.
json_schemaoptional object If provided, forces structured JSON output matching this schema (uses CompleteStructured).
stopoptional array[string] Stop sequences — generation stops when any sequence is produced.
streamoptional boolean If true, returns a stream handle ID for token-by-token consumption. Default: false. Default: False.

Output Fields

FieldTypeDescription
text string Generated text response.
json object Structured JSON output (when json_schema provided).
model string Model that generated the response.
provider string Provider that handled the request.
tokens_used integer
prompt_tokens integer
finish_reason string
latency_ms integer
stream_id string Stream handle ID when stream=true.

Examples

Simple completion with auto provider routing

// Input
{
  "prompt": "Explain recursion in one paragraph.",
  "temperature": 0.3,
  "max_tokens": 200
}

// Output
{
  "text": "Recursion is a technique where a function calls itself...",
  "model": "claude-sonnet-4-6",
  "provider": "anthropic",
  "tokens_used": 87,
  "finish_reason": "stop",
  "latency_ms": 340
}

Structured JSON extraction

// Input
{
  "prompt": "Extract the product info: 'MacBook Pro 16\" 2024, price $2499, in stock'",
  "json_schema": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string"
      },
      "price": {
        "type": "number"
      },
      "in_stock": {
        "type": "boolean"
      }
    }
  }
}

// Output
{
  "json": {
    "name": "MacBook Pro 16\" 2024",
    "price": 2499.0,
    "in_stock": true
  },
  "model": "gpt-4o",
  "provider": "openai",
  "tokens_used": 64,
  "latency_ms": 280
}

Install & Discovery

Install

ppm install mcp-llm

Get JSON Schema

GET /v1/packages/mcp-llm/1.0.0/schema

Discover by keyword

GET /v1/mcp/discover?q=llm
Discovery hint: Install with ppm install mcp-llm or invoke remotely via POST /v1/invoke/mcp-llm on the MCP Service.

PascalAI Usage

uses toolslib;
var Tool := LoadTool('mcp-llm');
var R := Tool.Call(JsonObj(['prompt','Summarize this text: '+text,'max_tokens',300]));
Writeln(R['text']);