Skip to main content
Glama

Add a menu item

add_menu_item

Add entries to WordPress navigation menus, targeting posts, pages, custom post types, taxonomy terms, or URLs. Nest items under parents to build submenus and set menu order for precise positioning.

Instructions

Add an entry to a navigation menu. It can point at a post, page or custom post type (object_id + object), a taxonomy term, or an arbitrary URL. Use parent to nest it under another item and menu_order to position it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoTarget URL. Required for type "custom".
xfnNoXFN relationship value for the link.
typeNocustom: an arbitrary URL. post_type: link to a post/page/CPT (set object + object_id). taxonomy: link to a term. post_type_archive: link to a CPT archive.custom
titleYesLink label.
objectNoFor post_type: the post type slug ("page"). For taxonomy: the taxonomy slug ("category").
parentNoMenu item ID to nest under, creating a submenu.
targetNo_blank opens in a new tab.
classesNoExtra CSS classes on the link.
menu_idYesMenu to add to.
site_idNoWhich configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids.
object_idNoID of the post or term being linked to.
attr_titleNoThe link's title attribute.
menu_orderNoPosition within the menu. Lower numbers come first.
descriptionNoItem description, shown by themes that support it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv2.0.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / menu_id / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / menu_id / minimum
      Added value: +-9007199254740991
    • addedInput schema / properties / menu_order / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / menu_order / minimum
      Added value: +-9007199254740991
    • addedInput schema / properties / object_id / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / object_id / minimum
      Added value: +-9007199254740991
    • addedInput schema / properties / parent / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / parent / minimum
      Added value: +-9007199254740991
  2. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already signal a non-read, non-destructive, non-idempotent mutation, and the description adds useful behavioral detail about supported link types and how parent and menu_order affect the item. It does not contradict the annotations and provides adequate transparency for a creation action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two well-organized sentences that front-load the core action and then cover link target types plus nesting/positioning. Every sentence earns its place with no filler.

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

Completeness4/5

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

For a 14-parameter mutation tool, the description plus a fully documented schema covers the key decisions: what the item can link to, required parameters, and how to nest or order the item. It does not explain return values or behavior on an invalid menu_id, but those are minor gaps given the absence of an output schema and the completeness of the input schema.

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 description coverage is 100%, so all parameters are already documented in the input schema. The description adds a useful mental model for object_id/object pairing and calls out parent and menu_order, but it does not provide substantive meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('Add an entry to a navigation menu') and clearly identifies the resource being modified. It also distinguishes this from sibling tools like update_menu_item, delete_menu_item, and reorder_menu_items by focusing on creation and listing the supported link target types.

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?

The description gives clear context for when to use the tool: adding a new menu item that can point to a post, term, or URL, with optional nesting and ordering. It does not explicitly name alternatives like update_menu_item or delete_menu_item, but the create-oriented wording and target coverage make the intended usage reasonably clear.

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