Skip to main content
Glama
fgui-agent-bridge

fgui-agent-bridge

by Wilson520403

fgui_replace_object_resource

Replace an Image/Loader image reference or a component instance's source component in FairyGUI, then optionally save and verify via disk comparison or document reload.

Instructions

通过 Editor API 替换 Image/Loader 图片引用或组件实例的源组件(0.8.21+);保存后默认比对磁盘 XML。Button 状态暂不支持。

组件实例换源组件走编辑器原生命令 Document.ReplaceSelection:id/name/xy/relation/显式 size 全部保留, 没有显式 size 时尺寸跟随新源组件(FGUI 语义,preserve_size 对组件实例不适用)。 expected_type 省略时按目标对象推导(image/loader→image,组件实例→component),显式传入则作为断言。

external_reload=True 会在保存后关闭并重新打开文档再比对,是唯一能证明「重新载入时值不丢」的验证;需要 save=True。响应中的 strength 字段标明验证强度:reload / disk / none。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "resource_url": "<resource_url>"
    },
    "name": "fgui_replace_object_resource"
  }
}

Input Schema

NameRequiredDescriptionDefault
saveNo
stateNo
verifyNo
object_idNo
object_nameNo
object_pathNo
resource_urlYes
expected_typeNo
external_reloadNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.8.25
    • addedInput schema / properties / expected_type / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / expected_type / default
      Previous value: -"image"New value: +null
    • removedInput schema / properties / expected_type / type
      Removed value: -"string"
  2. Addedv0.8.6

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations present, the description carries the full transparency burden and does substantial work: it discloses the native Document.ReplaceSelection command, that id/name/xy/relation/explicit size are preserved, that size follows the new source component absent explicit size, and what save/verify do by comparing on-disk XML. It even describes the meaning of the returned strength field (reload/disk/none). It omits permission requirements, undo/irreversibility, and failure modes.

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 content is front-loaded: the core action comes first, followed by the editor-command semantics, then the verification-strength explanation. The lines are dense and jargon-heavy (FGUI semantics, explicit size, reload/disk/none), but almost every sentence adds operational information.

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?

An output schema exists, so the return shape does not need to be explained, and the description covers mutation semantics and verification well. But for a 9-parameter tool with 0% schema coverage and no annotations, it leaves the target-selector parameters and state undefined, which is a real gap before an agent can call it correctly.

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 coverage is 0% across 9 parameters, so the description would have to compensate, and it covers expected_type and external_reload well. However, the target-selection parameters (object_id / object_name / object_path), resource_url format, state, save, and verify get no explanation. It also references a preserve_size parameter that is not in the schema, which is mildly confusing.

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 uses a specific verb and resource: replace an Image/Loader image reference or a component instance's source component through the Editor API, and it scopes the tool to fgui object-level resource swaps. It also states a clear exclusion ('Button 状态暂不支持'). It does not explicitly name sibling alternatives such as fgui_replace_references, so an agent must infer that this tool acts on document objects, not package-wide references.

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

Usage Guidelines4/5

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

It gives conditional guidance: use external_reload when you need proof that values survive a document reload, and that option requires save=True; expected_type is an assertion only when explicitly passed. It also notes what does not apply: Button states, and preserve_size for component instances. It never routes the agent to a sibling tool for the unsupported cases, which is the main gap.

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

Deploy Server

Other Tools