Skip to main content
Glama
xujfcn
by xujfcn

chat

Send messages to 627+ AI models including GPT-5, Claude, and Gemini through a single interface to get AI responses for various tasks.

Instructions

Send a message to any AI model via Crazyrouter. Supports 627+ models including GPT-5, Claude Opus 4.6, Gemini 3, DeepSeek R1, Llama 4, Qwen3, Grok 4, and more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNoThe AI model to use (default: gpt-5-mini). Examples: gpt-5, claude-opus-4-6, gemini-3-pro, deepseek-r1, llama-4-scout, qwen3-235b, grok-4gpt-5-mini
messagesYesArray of chat messages with role and content
temperatureNoSampling temperature (0-2). Lower = more deterministic, higher = more creative
max_tokensNoMaximum number of tokens to generate

Implementation Reference

  • The "chat" tool registration and handler implementation using the Crazyrouter API to perform model completion.
    server.tool(
      "chat",
      "Send a message to any AI model via Crazyrouter. Supports 627+ models including GPT-5, Claude Opus 4.6, Gemini 3, DeepSeek R1, Llama 4, Qwen3, Grok 4, and more.",
      {
        model: z
          .string()
          .default(DEFAULT_CHAT_MODEL)
          .describe(
            `The AI model to use (default: ${DEFAULT_CHAT_MODEL}). Examples: gpt-5, claude-opus-4-6, gemini-3-pro, deepseek-r1, llama-4-scout, qwen3-235b, grok-4`
          ),
        messages: z
          .array(
            z.object({
              role: z
                .enum(["system", "user", "assistant"])
                .describe("The role of the message sender"),
              content: z.string().describe("The message content"),
            })
          )
          .describe("Array of chat messages with role and content"),
        temperature: z
          .number()
          .min(0)
          .max(2)
          .optional()
          .describe(
            "Sampling temperature (0-2). Lower = more deterministic, higher = more creative"
          ),
        max_tokens: z
          .number()
          .optional()
          .describe("Maximum number of tokens to generate"),
      },
      async ({ model, messages, temperature, max_tokens }) => {
        try {
          const body: Record<string, unknown> = { model, messages };
          if (temperature !== undefined) body.temperature = temperature;
          if (max_tokens !== undefined) body.max_tokens = max_tokens;
    
          const result = (await apiRequest("/chat/completions", {
            method: "POST",
            body,
          })) as {
            choices?: Array<{ message?: { content?: string; role?: string }; finish_reason?: string }>;
            usage?: { prompt_tokens?: number; completion_tokens?: number; total_tokens?: number };
            model?: string;
          };
    
          const content = result.choices?.[0]?.message?.content ?? "No response content";
          const usage = result.usage;
          const actualModel = result.model ?? model;
    
          let text = content;
          if (usage) {
            text += `\n\n---\n📊 Model: ${actualModel} | Tokens: ${usage.prompt_tokens ?? "?"}→${usage.completion_tokens ?? "?"} (${usage.total_tokens ?? "?"} total)`;
          }
    
          return { content: [{ type: "text" as const, text }] };
        } catch (error) {
          const message = error instanceof Error ? error.message : "Unknown error occurred";
          return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the platform (Crazyrouter) and model support but lacks critical behavioral details: authentication requirements, rate limits, cost implications, response format, error handling, or whether it's stateful/conversational. 'Send a message' implies a write operation but doesn't clarify persistence or side effects.

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

Conciseness4/5

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

Two concise sentences with zero waste. The first states the core purpose, the second provides scope/context with specific examples. Well-structured and front-loaded with essential information.

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 tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks crucial context about response format, error conditions, authentication, rate limits, and cost—information an agent needs to use this tool effectively. The model examples are helpful but insufficient for full operational understanding.

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%, providing good documentation for all parameters. The description adds minimal parameter semantics beyond the schema—it mentions model examples but doesn't explain message structure or parameter interactions. Baseline 3 is appropriate since the schema does the heavy lifting.

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 action ('Send a message') and target ('to any AI model via Crazyrouter'), with specific examples of supported models. It distinguishes from sibling tools like generate_image and generate_video by focusing on chat interactions rather than media generation. However, it doesn't explicitly contrast with 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 Guidelines2/5

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

No explicit guidance on when to use this tool versus alternatives is provided. The description mentions 'Supports 627+ models' but doesn't explain when to choose specific models or when to use this versus list_models for discovery. Usage context is implied but not stated.

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/xujfcn/crazyrouter-mcp'

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