Skip to main content

manage_asset

Auto-generated from the Python tool registry. Do not hand-edit outside <!-- examples:start --><!-- examples:end --> blocks — the generator (tools/generate_docs_reference.py) will overwrite them.

Group: legacy  ·  Module: services.tools.manage_asset

Maturity: stable (support status; independent of enabled state, readiness and permissions).

Description​

Performs asset operations (import, create, modify, delete, etc.) in Unity. Read-only get_dependencies/get_reverse_references/preview_move/preview_delete use bounded AssetDatabase references, explicit scan_root, work/assets budgets and pages up to 100. reference_snapshot retains scalar pages; reference_cursor reuses them until expiry/import changes. reference_revision rechecks observations and optionally guards move/delete using matching scan options. String/custom-loader/Addressables references are not comprehensively discovered. Read-only list_asset_bundles/get_bundle_assets/get_bundle_dependencies inspect AssetDatabase assignments, not built bundle files; use bundle_name and pages of at most 100.

Tip (payload safety): for action="search", prefer paging (page_size, page_number) and keep generate_preview=false (previews can add large base64 blobs). Opt-in metadata_only search avoids explicit object/preview loads and returns a short-lived search_snapshot for reusable pages; keep query, scope, date and page_size unchanged. Label actions get/set/add/remove support 1-1024 targets; mutations require observed revisions, are sequential rather than atomic, and never automatically retry an uncertain write.

Parameters​

NameTypeRequiredDescription
actionLiteral['import', 'create', 'modify', 'delete', 'duplicate', 'move', 'rename', 'search', 'get_info', 'create_folder', 'get_components', 'list_asset_bundles', 'get_bundle_assets', 'get_bundle_dependencies', 'get_dependencies', 'get_reverse_references', 'preview_move', 'preview_delete', 'get_labels', 'set_labels', 'add_labels', 'remove_labels']yesPerform CRUD operations on assets.
pathstr | None—Asset path required for asset operations; search defaults to Assets. Ignored for bundle assignment inspection.
asset_typestr | None—Asset type (e.g., 'Material', 'Folder') - required for 'create'. Note: For ScriptableObjects, use manage_scriptable_object.
propertiesdict[str, Any] | str | None—Dictionary of properties for 'create'/'modify'. Keys are property names, values are property values.
destinationstr | None—Target path for 'duplicate'/'move'.
generate_previewbool—Generate previews up to 256 pixels per edge and 256 KiB PNG each; search allows at most 32 results and 4 MiB aggregate base64.
search_patternstr | None—Search pattern (e.g., '*.prefab' or AssetDatabase filters like 't:MonoScript'). Recommended: put queries like 't:MonoScript' here and set path='Assets'.
filter_typestr | None—Filter type for search
filter_date_afterstr | None—Date after which to filter
page_sizeint | str | None—Page size: search 1-1000 (default 50), previews 1-32 (default 32), bundle inspection 1-100 (default 50).
page_numberint | str | None—Page number for pagination (1-based).
bundle_namestr | None—Registered bundle assignment name for get_bundle_* actions.
recursivebool—Include indirect bundle dependencies (default false).
metadata_onlybool—Search only: return metadata with instanceID=0 and a bounded 60-second Editor-session snapshot; no explicit object/preview loads. Default false preserves legacy behavior.
search_snapshotstr | None—Search only: opaque token from metadata_only=true; repeat the effective query and page_size.
labelslist[str] | None—Exact labels; set replaces, empty set clears.
label_targetslist[AssetLabelTarget] | None—Common-operation batch; each mutation row requires revision.
label_revisionstr | None—Opaque revision from get_labels for a single-target mutation.
scan_rootstr | None—Reference actions: candidate/dependency folder (Assets by default).
max_assetsint | str | None—Reference actions: 1-250000; default 1024. Reverse scans count distinct eligible files, excluding folders/duplicates; forward scans count visited assets including the source.
max_workint | str | None—Reference actions: at most 1-4000000 node/edge work units; default 10000.
reference_snapshotbool | None—Reference reads/previews only: retain captured scalar pages for ten minutes idle.
reference_cursorstr | None—Reference reads/previews only: continue a captured observation with identical scan options. Imported changes invalidate it.
reference_revisionstr | None—Recheck the same bounded read/preview or guard move/delete immediately before mutation.
await_graph_secondsfloat | None—Asset writes only: wait 0..30 seconds for the existing active graph receipt and first diff page; never activates a graph.
include_dependenciesbool—get_bundle_assets only: include the first bounded dependency page without building bundles.
unity_instancestr | int | None—Target Unity instance for this call: Name@hash or hash prefix; an integer selects only that exact port over stdio and is rejected over HTTP. Read mcpforunity://instances for available targets. Omit to use the legacy active selection or the sole available instance.

Returns​

A dict containing the Unity response. The exact shape depends on the action.

Examples​

List AssetDatabase bundle assignments:

{"action":"list_asset_bundles","page_size":50,"page_number":1}

Use an exact returned bundle name to inspect assigned assets or dependencies:

{"action":"get_bundle_assets","bundle_name":"environment","page_size":50}
{"action":"get_bundle_dependencies","bundle_name":"environment","recursive":true}

These actions do not load or extract built bundle files. Other asset actions still require their target path; only search supplies Assets when the path is omitted.