package sitemap import ( "net/http" apicontrollers "git.golem15.com/golem15/sm-sitemap-plugin/controllers/api" "git.golem15.com/golem15/summercms/modules/pact" ) var _ pact.HasMCP = (*Plugin)(nil) // mcpGuard is the guard every sitemap tool runs as: the backend account // linked to the MCP user. The routes resolve that administrator themselves. const mcpGuard = "backend" // MCP declares the sitemap tools (D-10, UI-SPEC MCP parity): reading and // changing the settings screen's values (with the file list, the IndexNow // key and status) and queueing a rebuild, each bound to a /_sitemap/api/v1 // management route, run as the backend account linked to the MCP user and // listed only when that account has the sitemap permission. pier prefixes // them with sitemap_. func (p *Plugin) MCP() pact.MCP { return pact.MCP{Tools: []pact.MCPTool{ { Name: "get_settings", Title: "Show the sitemap settings", Description: "Shows the sitemap settings (site address, file size, additional addresses, image and News sitemaps, IndexNow, HTML sitemap), the content types with their file names and headings, the files of the index with their address counts, the addresses left out by reason, the IndexNow key and last notification, and the values the News sources take.", Guard: mcpGuard, Method: http.MethodGet, Path: "/_sitemap/api/v1/settings", Input: struct{}{}, Permissions: []string{apicontrollers.PermissionManage}, }, { Name: "update_settings", Title: "Update the sitemap settings", Description: "Changes the sitemap settings sent and, under types, the settings of content types by key, with the checks of the settings screen. Turning IndexNow on generates its key; indexnow_new_key replaces it. The sitemaps are rebuilt afterwards.", Guard: mcpGuard, Method: http.MethodPut, Path: "/_sitemap/api/v1/settings", Input: apicontrollers.UpdateSettingsInput{}, Permissions: []string{apicontrollers.PermissionManage}, }, { Name: "rebuild", Title: "Rebuild the sitemaps", Description: "Queues a rebuild of the sitemap files now, as a settings save does; get_settings shows building until it has run.", Guard: mcpGuard, Method: http.MethodPost, Path: "/_sitemap/api/v1/rebuild", Input: struct{}{}, Permissions: []string{apicontrollers.PermissionManage}, }, }} }