snippetsCode snippets Abilities
Code snippets integration. Code-snippet definitions (id, name, scope, type, active and locked state), never a code body. Write tools additionally require the "Allow code snippets" toggle and refuse PHP.
manage_options 4Available Tools (4)
snippet_listmanage_optionsList code snippets managed by the Code Snippets plugin. Returns id, name, scope, type (php/css/js/html), active state, and locked state for each - not the code bodies. A locked snippet cannot be updated: Code Snippets silently discards changes to its code and name, so check locked before attempting a write. Read-only.
snippet_getmanage_optionsGet one code snippet by id, including its code body, scope, type, description, active state, and locked state. A locked snippet cannot be updated: Code Snippets silently discards changes to its code and name. Read-only. Seeing a PHP snippet's body does not run it.
snippet_createmanage_optionsCreate a CSS or JS code snippet. PHP snippets cannot be created (that is remote code execution) and are refused. The snippet is always saved DISABLED: a human must activate it in the Code Snippets UI before it runs - this tool never activates code. Requires the "Allow code snippets" admin toggle, manage_options, and two-part confirmation (confirm=true plus confirm_slug echoing the returned slug). Emits an undo token. Markdown code fences in the body are stripped.
snippet_updatemanage_optionsUpdate the code and/or name of an existing CSS or JS snippet. A PHP snippet cannot be updated through this tool and is refused. A snippet locked in Code Snippets is also refused: the plugin silently discards changes to a locked snippet's code and name, so unlock it there first. The write is verified against what was stored and reported as an error if the plugin kept its own value, rather than returning success on a discarded write. The snippet's active state is never changed - an active snippet stays active, a disabled one stays disabled. Requires the "Allow code snippets" toggle, manage_options, and two-part confirmation. Emits an undo token only when the write actually landed.