Skip to main content
Glama

hzls

Read-only

Convert text into images using Magic: The Gathering card art. Customize output with full card images or include watermark links for creative or functional use cases.

Instructions

活字乱刷(使用卡牌图像拼接句子),将输入的文本使用魔法卡牌图像拼接成图片

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cut_full_imageNo是否使用卡牌完整图像 (默认 true)
target_sentenceYes要拼接的目标句子/文本
with_linkNo是否包含链接水印 (默认 true)

Implementation Reference

  • The async function handleHzls that implements the core logic of the 'hzls' tool: constructs the API URL for /hzls endpoint with parameters, fetches the response, handles errors, converts image to base64, and returns text + image content.
    async function handleHzls(
      targetSentence: string,
      cutFullImage?: boolean,
      withLink?: boolean,
      config?: z.infer<typeof configSchema>
    ) {
      // 构建基础 URL
      let url = `${config?.apiUrl || BASE_URL}/hzls?target_sentence=${encodeURIComponent(targetSentence)}`;
    
      // 添加可选参数
      if (cutFullImage !== undefined) url += `&cut_full_image=${cutFullImage}`;
      if (withLink !== undefined) url += `&with_link=${withLink}`;
    
      try {
        const response = await fetch(url);
        
        // 处理错误响应
        if (!response.ok) {
          const errorText = await response.text().catch(() => "");
          return {
            content: [
              {
                type: "text",
                text: `HTTP 错误 ${response.status}: ${response.statusText}${errorText ? `\n响应内容: ${errorText}` : ""}`
              }
            ],
            isError: true
          };
        }
        
        // 处理成功响应 - 读取图片数据
        const buffer = await response.arrayBuffer();
        const base64Data = Buffer.from(buffer).toString('base64');
        const contentType = response.headers.get('content-type') || 'image/jpeg';
        
        // 返回图像内容
        return {
          content: [
            {
              type: "text",
              text: `活字乱刷成功生成图片`
            },
            {
              type: "image",
              data: base64Data,
              mimeType: contentType
            }
          ],
          isError: false
        };
      } catch (error) {
        // 捕获所有其他错误(网络错误、解析错误等)
        return {
          content: [
            {
              type: "text",
              text: `活字乱刷请求失败: ${(error as Error).message}` 
            },
            {
              type: "text",
              text: `活字乱刷成功生成图片链接:\n${url}`
            }
          ],
          isError: true
        };
      }
    }
  • The Tool object HZLS_TOOL defining the 'hzls' tool: name, description, inputSchema with properties target_sentence (required), cut_full_image, with_link, and annotations.
    const HZLS_TOOL: Tool = {
      name: "hzls",
      description: "活字乱刷(使用卡牌图像拼接句子),将输入的文本使用魔法卡牌图像拼接成图片",
      inputSchema: {
        type: "object",
        properties: {
          target_sentence: {
            type: "string",
            description: "要拼接的目标句子/文本"
          },
          cut_full_image: {
            type: "boolean",
            description: "是否使用卡牌完整图像 (默认 true)"
          },
          with_link: {
            type: "boolean",
            description: "是否包含链接水印 (默认 true)"
          }
        },
        required: ["target_sentence"]
      },
      annotations: {
        title: "使用卡牌图像拼接句子",
        readOnlyHint: true,
        openWorldHint: true
      }
    };
  • index.ts:269-276 (registration)
    Registration of 'hzls' tool by including HZLS_TOOL in the SBWSZ_TOOLS array, which is returned by listTools handler.
    const SBWSZ_TOOLS = [
      GET_CARD_BY_SET_AND_NUMBER_TOOL,
      SEARCH_CARDS_TOOL,
      GET_SETS_TOOL,
      GET_SET_TOOL,
      GET_SET_CARDS_TOOL,
      HZLS_TOOL
    ] as const;
  • index.ts:528-535 (registration)
    In the CallToolRequestSchema request handler switch statement, the case for 'hzls' that extracts arguments and invokes the handleHzls function.
    case "hzls": {
      const { target_sentence, cut_full_image, with_link } = args as {
        target_sentence: string;
        cut_full_image?: boolean;
        with_link?: boolean;
      };
      return await handleHzls(target_sentence, cut_full_image, with_link, config);
    }
Behavior3/5

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

Annotations already provide readOnlyHint=true and openWorldHint=true, indicating this is a safe read operation with potentially unpredictable outputs. The description adds useful context about the specific behavior (using card images to stitch text into a picture) and mentions the '活字乱刷' concept, but doesn't disclose important behavioral traits like output format, image dimensions, processing time, or error conditions that would help an agent use it effectively.

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?

The description is appropriately concise with just one sentence that directly states the tool's purpose. It's front-loaded with the core functionality and wastes no words. The Chinese name '活字乱刷' adds some cultural context but doesn't detract from clarity for a Chinese-speaking agent.

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

Completeness3/5

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

Given the tool has no output schema and annotations only cover basic safety hints, the description should do more to explain what the tool returns (presumably an image file/URL) and any important behavioral constraints. For an image generation tool with 3 parameters, the current description is minimally adequate but leaves significant gaps about output format, quality expectations, and practical usage considerations.

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?

With 100% schema description coverage, the input schema already documents all three parameters thoroughly. The description doesn't add any meaningful parameter semantics beyond what's in the schema - it mentions '输入的文本' (input text) which corresponds to target_sentence, but provides no additional context about parameter interactions, constraints, or usage patterns.

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: '将输入的文本使用魔法卡牌图像拼接成图片' (use magic card images to stitch input text into a picture). It specifies both the action (stitching/拼接) and resource (card images/卡牌图像), though it doesn't explicitly differentiate from sibling tools which appear to be card lookup/search tools rather than image generation tools.

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 alternatives. It doesn't mention any prerequisites, constraints, or comparison with sibling tools like get_card_by_set_and_number or search_cards. The only implied usage is when you want to create an image from text using card images.

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

Related 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/lieyanqzu/sbwsz-mcp'

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