Skip to content

Resource-based authorization on toolsΒ #450

Open
@delepster

Description

@delepster

Is your feature request related to a problem? Please describe.
Some tools require a resource-based authorization to authorize the tool use, while other tools do not. In a web API, we can use the [Authorize("some policy")] attribute, but it is not possible (the handler is not called) with [McpServerTool] methods, the same authorization is applied to the entire group.

Describe the solution you'd like
Allow to specify the authorization policy for specific tools. Since the resource is identified in the tool's parameters, an access to RequestContext<CallToolRequestParams> would be best.

Describe alternatives you've considered
The only alternative I could think of is to check the RequestUri for "/message", parse the body to create a RequestContext<CallToolRequestParams>

Additional context
tl;dr; offer resource-based authorization on tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions