Files
sm-user-plugin/mcp.go
Jakub Zych 66fc107eb9 feat: name the missing scope or permission in 403 bodies
A refusal by user.scope:<scope> now answers 403 with missing_scope and a
refusal by user.permission:<code> with missing_permission, next to the
unchanged error (true) and message, so a plain-HTTP script or a personal
token client learns what it lacks. user_me says it needs scope read.
2026-10-28 14:05:57 +01:00

25 lines
662 B
Go

package user
import (
"net/http"
"git.golem15.com/golem15/summercms/modules/pact"
)
var _ pact.HasMCP = (*Plugin)(nil)
// MCP declares the plugin's MCP tools (D-18). me (exposed as user_me) runs
// GET /_user/api/v1/token/me as the signed-in frontend user under the
// "user" guard and answers the user payload.
func (p *Plugin) MCP() pact.MCP {
return pact.MCP{Tools: []pact.MCPTool{{
Name: "me",
Title: "Current user",
Description: "Returns the profile of the signed-in frontend user. Needs scope read.",
Guard: "user",
Method: http.MethodGet,
Path: "/_user/api/v1/token/me",
Input: struct{}{},
}}}
}