@prefecthq/fastmcp-ts 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -970,6 +970,11 @@ declare class Client implements IClient {
970
970
  * via a `subscriptions/listen` stream opted into `resourceSubscriptions` — both
971
971
  * dispatch to the same `notifications/resources/updated` handler registered in
972
972
  * `_registerHandlers`, so this method is the only era-aware part.
973
+ *
974
+ * On a modern connection this rejects when the server's acknowledged filter does
975
+ * not include the URI — that is how a server without the `resources.subscribe`
976
+ * capability declines per-resource subscriptions, and registering a handler that
977
+ * can never fire would fail silently instead.
973
978
  */
974
979
  subscribeResource(uri: string, handler: ResourceUpdateHandler, options?: RequestOptions): Promise<void>;
975
980
  unsubscribeResource(uri: string, options?: RequestOptions): Promise<void>;
package/dist/client.js CHANGED
@@ -1770,11 +1770,24 @@ var Client = class _Client {
1770
1770
  * via a `subscriptions/listen` stream opted into `resourceSubscriptions` — both
1771
1771
  * dispatch to the same `notifications/resources/updated` handler registered in
1772
1772
  * `_registerHandlers`, so this method is the only era-aware part.
1773
+ *
1774
+ * On a modern connection this rejects when the server's acknowledged filter does
1775
+ * not include the URI — that is how a server without the `resources.subscribe`
1776
+ * capability declines per-resource subscriptions, and registering a handler that
1777
+ * can never fire would fail silently instead.
1773
1778
  */
1774
1779
  async subscribeResource(uri, handler, options) {
1775
1780
  this._resourceSubscriptions.set(uri, handler);
1776
1781
  if (this._sdk().getProtocolEra() === "modern") {
1777
1782
  await this._refreshResourceListenSubscription();
1783
+ const honored = this._resourceListenSubscription?.honoredFilter.resourceSubscriptions ?? [];
1784
+ if (!honored.includes(uri)) {
1785
+ this._resourceSubscriptions.delete(uri);
1786
+ await this._refreshResourceListenSubscription();
1787
+ throw new Error(
1788
+ `subscribeResource(${JSON.stringify(uri)}): the server did not honor the subscription \u2014 its subscriptions/acknowledged filter omits the URI, which means it does not advertise the resources.subscribe capability.`
1789
+ );
1790
+ }
1778
1791
  } else {
1779
1792
  await this._reauthRetry(
1780
1793
  () => this._sdk().subscribeResource(