@drupalmcp/adk 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -69,9 +69,16 @@ every turn.
69
69
 
70
70
  ```ts
71
71
  drupalTools({ auth, only: ['tool_api__tool_belt_entity_list'] });
72
+ drupalTools({ auth, except: ['tool_api__tool_belt_entity_bundle_list'] });
72
73
  ```
73
74
 
74
- `only` narrows the tool list. It is a convenience, not a boundary: what the
75
- agent may actually do is decided by the credential's scopes on the server.
75
+ `only` narrows the tool list and `except` removes from it. Both are a
76
+ convenience, not a boundary: what the agent may actually do is decided by the
77
+ credential's scopes on the server.
78
+
79
+ `except` earns its keep for a tool the site publishes that this credential can
80
+ never run. Listing a content type's bundles, for instance, needs an
81
+ administrator permission an agent should not have, so offering the tool only
82
+ invites a refusal in the middle of a job.
76
83
 
77
84
  Apache-2.0. Part of [drupalmcp-ts](https://github.com/Omedia/drupalmcp-ts).
package/dist/index.d.ts CHANGED
@@ -72,6 +72,12 @@ interface DrupalToolsOptions {
72
72
  * site publishes; the credential's scopes still decide what may run.
73
73
  */
74
74
  only?: string[];
75
+ /**
76
+ * Leave these tools out. Useful for a tool the site publishes but this
77
+ * credential can never run, such as one that needs an administrator
78
+ * permission: offering it only invites a refusal mid-conversation.
79
+ */
80
+ except?: string[];
75
81
  /** Prefix added to every tool name, for telling two sites apart. */
76
82
  prefix?: string;
77
83
  }
@@ -203,6 +209,6 @@ declare function scopeFromChallenge(challenge: string | null | undefined): strin
203
209
  declare function describeRefusal(error: unknown): string | null;
204
210
 
205
211
  /** Kept in step with package.json; sent as the user agent. */
206
- declare const VERSION = "0.1.0";
212
+ declare const VERSION = "0.1.1";
207
213
 
208
214
  export { AUTHENTICATION_REQUIRED_CODE, type AgentDefinition, type AgentSummary, type DrupalAgentOptions, DrupalOAuth, type DrupalOAuthOptions, type DrupalToolsOptions, INSUFFICIENT_SCOPE_CODE, type JsonSchema, VERSION, describeRefusal, drupalAgent, drupalTools, listAgents, normaliseSchema, promptFrom, scopeFromChallenge };
package/dist/index.js CHANGED
@@ -194,11 +194,11 @@ function walk(node, isProperty) {
194
194
  }
195
195
 
196
196
  // src/version.ts
197
- var VERSION = "0.1.0";
197
+ var VERSION = "0.1.1";
198
198
 
199
199
  // src/toolset.ts
200
200
  function drupalTools(options) {
201
- const { auth, only, prefix } = options;
201
+ const { auth, only, except, prefix } = options;
202
202
  const baseUrl = (options.baseUrl ?? auth.baseUrl).replace(/\/+$/, "");
203
203
  const lastChallenge = { value: null };
204
204
  const toolset = new MCPToolset(
@@ -219,7 +219,7 @@ function drupalTools(options) {
219
219
  }
220
220
  }
221
221
  },
222
- only,
222
+ toolFilter(only, except),
223
223
  prefix
224
224
  );
225
225
  return prepareTools(toolset, lastChallenge);
@@ -251,6 +251,14 @@ function prepareTools(toolset, lastChallenge) {
251
251
  };
252
252
  return toolset;
253
253
  }
254
+ function toolFilter(only, except) {
255
+ if (!except?.length) {
256
+ return only;
257
+ }
258
+ const blocked = new Set(except);
259
+ const wanted = only ? new Set(only) : null;
260
+ return (tool) => !blocked.has(tool.name) && (wanted === null || wanted.has(tool.name));
261
+ }
254
262
  function withScope(message, scope) {
255
263
  return message.replace("is not allowed to do that", `does not hold the ${scope} scope`);
256
264
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drupalmcp/adk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Use a Drupal site from a Google ADK agent: OAuth, scoped MCP tools, and agents defined in Drupal.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",