Interface McpToolGrantProvider


public interface McpToolGrantProvider
The store of standing tool approvals, contributed by another add-on (the AI add-on): the MCP server decides, the provider only keeps the grants. With no provider installed no grant ever applies and every approval-gated call shows its card, as before standing approvals existed.

A contributor is a Spring @Service with an explicit, unique bean name, non-final, so that the Kernel/Spring bridge exports it to the MCP server's context as a proxy of its class.

  • Method Details

    • findGrants

      List<McpToolGrant> findGrants(String username, String toolName)
      Lists the candidate grants for one call: the user's own grants of the tool and the platform grants of the tool, neither revoked nor expired. The MCP server checks every returned grant again (owner, expiry, agent, constraint, interactivity) before applying one, so a provider returning too much never widens a decision.
      Parameters:
      username - the calling user, never blank
      toolName - the MCP tool name
      Returns:
      the candidate grants, never null
    • recordUse

      void recordUse(long grantId, McpToolGrantRequest request)
      Records that a call ran under a grant (last use and use count). Called after the decision and before the tool runs; a failure here is logged by the caller and does not stop the call, whose run is traced anyway.
      Parameters:
      grantId - the grant that applied
      request - the call it applied to
    • createGrant

      McpToolGrant createGrant(McpToolGrant grant, McpToolGrantRequest request)
      Stores a new grant the user chose on an approval card. Every field of the grant was derived by the MCP server from the pending call and the checked choice; the provider still enforces its own limits (maximum validity) and may refuse by throwing.
      Parameters:
      grant - the grant to store, without id
      request - the pending call the card was shown for
      Returns:
      the stored grant, with its id