Skip to content

feat(intelligence): expose MCP instance icon options#1848

Merged
UNIkeEN merged 2 commits into
mainfrom
codex/mcp-icon-options
Jul 13, 2026
Merged

feat(intelligence): expose MCP instance icon options#1848
UNIkeEN merged 2 commits into
mainfrom
codex/mcp-icon-options

Conversation

@xunying123

@xunying123 xunying123 commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Checklist

  • Changes have been tested locally and work as expected.
  • All tests in workflows pass successfully.
  • Documentation has been updated if necessary.
  • Code formatting and commit messages align with the project's conventions.
  • Comments have been added for any complex logic or functionality if possible.

This PR is a ..

  • 🆕 New feature
  • 🐞 Bug fix
  • 🛠 Refactoring
  • ⚡️ Performance improvement
  • 🌐 Internationalization
  • 📄 Documentation improvement
  • 🎨 Code style optimization
  • ❓ Other (Please specify below)

Related Issues

Follow-up to #1846.

Description

This PR exposes the supported instance icon sources through MCP.

It adds retrieve_instance_icon_options, which returns the built-in icon paths accepted by create_instance.icon_src, including icons such as CommandBlock.png, CraftingTable.png, GrassBlock.png, and Anvil.png. The create_instance tool description now points MCP clients to this option list when choosing a manual instance icon.

The create_instance.icon_src schema description also documents the automatic default icon behavior and the special custom value.

Additional Context

Verified with:

  • cargo fmt --manifest-path src-tauri/Cargo.toml --check
  • cargo check --manifest-path src-tauri/Cargo.toml

Summary by Sourcery

Expose supported Minecraft instance icon options through MCP and document automatic and custom icon behaviors for instance creation.

New Features:

  • Add an MCP tool to retrieve supported instance icon sources, including built-in icon paths and the custom option.

Enhancements:

  • Update the create_instance tool description and schema to reference the icon options helper and clarify automatic default icon selection and supported icon paths.
  • Extend the documented mod loader types for instances to include liteloader.

@sourcery-ai

sourcery-ai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Expose supported Minecraft instance icon options to MCP clients by adding a new retrieval tool and enriching the create_instance tool schema and description with explicit icon behavior and loader support.

Sequence diagram for MCP client using instance icon options

sequenceDiagram
  actor McpClient
  participant McpServer

  McpClient->>McpServer: retrieve_instance_icon_options
  McpServer-->>McpClient: builtinIconPaths, customIconSrc, automaticDefaultDescription

  McpClient->>McpServer: create_instance icon_src
  McpServer-->>McpClient: instance_created_response
Loading

File-Level Changes

Change Details Files
Add MCP tool to retrieve supported instance icon options for create_instance.icon_src.
  • Register new retrieve_instance_icon_options route in tool_routes using mcp_tool!.
  • Implement async handler that returns a JSON object with builtinIconPaths, customIconSrc, customIconDescription, and automaticDefaultDescription.
  • Enumerate all supported built-in icon paths and the special custom value in the response payload.
src-tauri/src/intelligence/mcp_server/launcher/tools/instance.rs
Document icon selection behavior and available options in the create_instance tool description and schema.
  • Extend create_instance tool description string to reference retrieve_instance_icon_options and describe automatic default icon logic when icon_src is omitted.
  • Replace icon_src schemars description with detailed rules for automatic icon selection based on OptiFine, mod loader type, and game version category.
  • List all supported built-in icon paths and clarify that custom should only be used when a custom icon file already exists in the instance root.
src-tauri/src/intelligence/mcp_server/launcher/tools/instance.rs
Expand supported mod loader types in the create_instance schema documentation.
  • Update mod_loader_type schemars description to include liteloader alongside existing loader types.
  • Keep default behavior (unknown) unchanged while clarifying the full set of accepted loader type values.
src-tauri/src/intelligence/mcp_server/launcher/tools/instance.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 11, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The list of built-in icon paths is now duplicated between retrieve_instance_icon_options and the create_instance.icon_src schema description; consider centralizing this list in a single source to avoid future drift.
  • The icon_src schemars description has become quite long and dense; consider breaking this behavior out into more structured metadata (or referencing retrieve_instance_icon_options more succinctly) to keep the schema description readable.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The list of built-in icon paths is now duplicated between `retrieve_instance_icon_options` and the `create_instance.icon_src` schema description; consider centralizing this list in a single source to avoid future drift.
- The `icon_src` schemars description has become quite long and dense; consider breaking this behavior out into more structured metadata (or referencing `retrieve_instance_icon_options` more succinctly) to keep the schema description readable.

## Individual Comments

### Comment 1
<location path="src-tauri/src/intelligence/mcp_server/launcher/tools/instance.rs" line_range="146" />
<code_context>
+        #[schemars(description = "Optional instance icon source. Omit to let SJMCL pick automatically: OptiFine uses `/images/icons/OptiFine.png`; Fabric, Forge/LegacyForge, NeoForge, LiteLoader, and Quilt use their matching `/images/icons/*.png`; otherwise snapshots use `/images/icons/JEIcon_Snapshot.png`, old beta uses `/images/icons/StoneOldBeta.png`, April Fools versions use `/images/icons/YellowGlazedTerracotta.png`, and releases use `/images/icons/JEIcon_Release.png`. Supported built-in icon paths are `/images/icons/JEIcon_Release.png`, `/images/icons/JEIcon_Snapshot.png`, `/images/icons/CommandBlock.png`, `/images/icons/CraftingTable.png`, `/images/icons/GrassBlock.png`, `/images/icons/StoneOldBeta.png`, `/images/icons/YellowGlazedTerracotta.png`, `/images/icons/Anvil.png`, `/images/icons/Forge.png`, `/images/icons/Fabric.png`, `/images/icons/NeoForge.png`, `/images/icons/Quilt.png`, and `/images/icons/OptiFine.png`. Pass `custom` only when the instance root already has a custom icon file to display.")]
</code_context>
<issue_to_address>
**issue:** The description mentions LiteLoader having a matching icon, but the built-in icon path list does not include a LiteLoader icon.

The description claims LiteLoader has a matching `/images/icons/*.png`, but the listed supported built-in paths do not include a LiteLoader icon (e.g. `/images/icons/LiteLoader.png`). This inconsistency may mislead clients using `retrieve_instance_icon_options` or the schema. Please either add the LiteLoader icon path or revise the description so it doesn’t imply a supported LiteLoader icon that isn’t listed.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src-tauri/src/intelligence/mcp_server/launcher/tools/instance.rs Outdated
#[schemars(description = "Optional instance description. Defaults to an empty string.")]
description: Option<String>,
#[schemars(description = "Optional instance icon source. Defaults to the selected OptiFine/mod loader icon, or the standard icon for the selected game version type.")]
#[schemars(description = "Optional instance icon source. Omit to let SJMCL pick automatically: OptiFine uses `/images/icons/OptiFine.png`; Fabric, Forge/LegacyForge, NeoForge, LiteLoader, and Quilt use their matching `/images/icons/*.png`; otherwise snapshots use `/images/icons/JEIcon_Snapshot.png`, old beta uses `/images/icons/StoneOldBeta.png`, April Fools versions use `/images/icons/YellowGlazedTerracotta.png`, and releases use `/images/icons/JEIcon_Release.png`. Supported built-in icon paths are `/images/icons/JEIcon_Release.png`, `/images/icons/JEIcon_Snapshot.png`, `/images/icons/CommandBlock.png`, `/images/icons/CraftingTable.png`, `/images/icons/GrassBlock.png`, `/images/icons/StoneOldBeta.png`, `/images/icons/YellowGlazedTerracotta.png`, `/images/icons/Anvil.png`, `/images/icons/Forge.png`, `/images/icons/Fabric.png`, `/images/icons/NeoForge.png`, `/images/icons/Quilt.png`, and `/images/icons/OptiFine.png`. Pass `custom` only when the instance root already has a custom icon file to display.")]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里就不用列举这些 /images/icons/... 了吧,可以在这里提醒模型如果要 pick built-in、去调用上面那个 tool

#[schemars(description = "Minecraft game version ID, for example `1.21.5`.")]
game_version: String,
#[schemars(description = "Optional mod loader type: `unknown`, `fabric`, `forge`, `legacyforge`, `neoforge`, or `quilt`. Defaults to `unknown`.")]
#[schemars(description = "Optional mod loader type: `unknown`, `fabric`, `forge`, `legacyforge`, `neoforge`, `liteloader`, or `quilt`. Defaults to `unknown`.")]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

liteloader 目前启动器不支持,要不就不写了

@UNIkeEN
UNIkeEN merged commit c2121fc into main Jul 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants