Class: Portage::Ucp::RateLimiter Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/portage/ucp/rate_limiter.rb

Overview

This class is abstract.

Pluggable rate-limit hook for mutating capabilities (§9). The gem bundles no limiter (no storage assumption) — #check! is called before every mutating tool call and must raise Portage::Ucp::RateLimitExceededError to block it. The default, NullRateLimiter, never limits: a consumer opts in to limiting by configuring one, same as the manifest/webhook signing story elsewhere in §9.

Direct Known Subclasses

NullRateLimiter

Instance Method Summary collapse

Instance Method Details

#check!(_key, _capability) ⇒ Object

Parameters:

  • key (String)

    a per-session/per-caller identifier the consumer derives from the MCP server_context (§9 says "per-session/per-key" — which one is up to the consumer's auth setup).

  • capability (String)

    the capability name being called, e.g. "dev.ucp.shopping.cart", so limits can be scoped per capability.

Raises:



15
16
17
# File 'lib/portage/ucp/rate_limiter.rb', line 15

def check!(_key, _capability)
  raise NotImplementedError, "#{self.class} must implement #check!"
end