@google/gemini-cli-a2a-server 0.33.0 → 0.33.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.
@@ -108573,7 +108573,7 @@ var init_mcp_tool = __esm({
108573
108573
  return safeJsonStringify(this.params);
108574
108574
  }
108575
108575
  };
108576
- DiscoveredMCPTool = class _DiscoveredMCPTool extends BaseDeclarativeTool {
108576
+ DiscoveredMCPTool = class extends BaseDeclarativeTool {
108577
108577
  mcpTool;
108578
108578
  serverName;
108579
108579
  serverToolName;
@@ -108625,9 +108625,6 @@ var init_mcp_tool = __esm({
108625
108625
  getFullyQualifiedName() {
108626
108626
  return generateValidName(`${this.serverName}${MCP_QUALIFIED_NAME_SEPARATOR}${this.serverToolName}`);
108627
108627
  }
108628
- asFullyQualifiedTool() {
108629
- return new _DiscoveredMCPTool(this.mcpTool, this.serverName, this.serverToolName, this.description, this.parameterSchema, this.messageBus, this.trust, this.isReadOnly, this.getFullyQualifiedName(), this.cliConfig, this.extensionName, this.extensionId, this._toolAnnotations);
108630
- }
108631
108628
  createInvocation(params, messageBus, _toolName, _displayName) {
108632
108629
  return new DiscoveredMCPToolInvocation(this.mcpTool, this.serverName, this.serverToolName, _displayName ?? this.displayName, messageBus, this.trust, params, this.cliConfig, this.description, this.parameterSchema, this._toolAnnotations);
108633
108630
  }
@@ -198422,18 +198419,28 @@ function isValidToolName(name3, options = {}) {
198422
198419
  if (options.allowWildcards && name3 === "*") {
198423
198420
  return true;
198424
198421
  }
198425
- if (name3.includes("__")) {
198426
- const parts2 = name3.split("__");
198427
- if (parts2.length !== 2 || parts2[0].length === 0 || parts2[1].length === 0) {
198422
+ if (isMcpToolName(name3)) {
198423
+ if (name3 === `${MCP_TOOL_PREFIX}*` && options.allowWildcards) {
198424
+ return true;
198425
+ }
198426
+ if (name3.startsWith(`${MCP_TOOL_PREFIX}_`)) {
198428
198427
  return false;
198429
198428
  }
198430
- const server = parts2[0];
198431
- const tool = parts2[1];
198432
- if (tool === "*") {
198433
- return !!options.allowWildcards;
198429
+ const parsed = parseMcpToolName(name3);
198430
+ if (parsed.serverName && parsed.toolName) {
198431
+ const slugRegex = /^[a-z0-9_.:-]+$/i;
198432
+ if (!slugRegex.test(parsed.serverName)) {
198433
+ return false;
198434
+ }
198435
+ if (parsed.toolName === "*") {
198436
+ return options.allowWildcards === true;
198437
+ }
198438
+ if (/^_*$/.test(parsed.toolName)) {
198439
+ return false;
198440
+ }
198441
+ return slugRegex.test(parsed.toolName);
198434
198442
  }
198435
- const slugRegex = /^[a-z0-9_.:-]+$/i;
198436
- return slugRegex.test(server) && slugRegex.test(tool);
198443
+ return false;
198437
198444
  }
198438
198445
  return false;
198439
198446
  }
@@ -198442,6 +198449,7 @@ var init_tool_names = __esm({
198442
198449
  "packages/core/dist/src/tools/tool-names.js"() {
198443
198450
  "use strict";
198444
198451
  init_coreTools();
198452
+ init_mcp_tool();
198445
198453
  EDIT_TOOL_NAMES = /* @__PURE__ */ new Set([EDIT_TOOL_NAME, WRITE_FILE_TOOL_NAME]);
198446
198454
  WRITE_FILE_DISPLAY_NAME = "WriteFile";
198447
198455
  EDIT_DISPLAY_NAME = "Edit";
@@ -199994,8 +200002,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
199994
200002
  var init_git_commit = __esm({
199995
200003
  "packages/core/dist/src/generated/git-commit.js"() {
199996
200004
  "use strict";
199997
- GIT_COMMIT_INFO = "6ee19e1f6";
199998
- CLI_VERSION = "0.33.0";
200005
+ GIT_COMMIT_INFO = "f59f9e931";
200006
+ CLI_VERSION = "0.33.1";
199999
200007
  }
200000
200008
  });
200001
200009
 
@@ -277232,7 +277240,7 @@ function getVersion() {
277232
277240
  }
277233
277241
  versionPromise = (async () => {
277234
277242
  const pkgJson = await getPackageJson(__dirname3);
277235
- return "0.33.0";
277243
+ return "0.33.1";
277236
277244
  })();
277237
277245
  return versionPromise;
277238
277246
  }
@@ -279243,11 +279251,7 @@ Signal: Signal number or \`(none)\` if no signal was received.
279243
279251
  */
279244
279252
  registerTool(tool) {
279245
279253
  if (this.allKnownTools.has(tool.name)) {
279246
- if (tool instanceof DiscoveredMCPTool) {
279247
- tool = tool.asFullyQualifiedTool();
279248
- } else {
279249
- debugLogger.warn(`Tool with name "${tool.name}" is already registered. Overwriting.`);
279250
- }
279254
+ debugLogger.warn(`Tool with name "${tool.name}" is already registered. Overwriting.`);
279251
279255
  }
279252
279256
  this.allKnownTools.set(tool.name, tool);
279253
279257
  }
@@ -279521,7 +279525,14 @@ Signal: Signal number or \`(none)\` if no signal was received.
279521
279525
  for (const name3 of toolNames) {
279522
279526
  const tool = this.getTool(name3);
279523
279527
  if (tool) {
279524
- declarations.push(tool.getSchema(modelId));
279528
+ let schema2 = tool.getSchema(modelId);
279529
+ if (tool instanceof DiscoveredMCPTool) {
279530
+ schema2 = {
279531
+ ...schema2,
279532
+ name: tool.getFullyQualifiedName()
279533
+ };
279534
+ }
279535
+ declarations.push(schema2);
279525
279536
  }
279526
279537
  }
279527
279538
  return declarations;
@@ -279581,16 +279592,6 @@ Signal: Signal number or \`(none)\` if no signal was received.
279581
279592
  debugLogger.debug(`Resolved legacy tool name "${name3}" to current name "${currentName}"`);
279582
279593
  }
279583
279594
  }
279584
- if (!tool && name3.includes("__")) {
279585
- for (const t3 of this.allKnownTools.values()) {
279586
- if (t3 instanceof DiscoveredMCPTool) {
279587
- if (t3.getFullyQualifiedName() === name3) {
279588
- tool = t3;
279589
- break;
279590
- }
279591
- }
279592
- }
279593
- }
279594
279595
  if (tool && this.isActiveTool(tool)) {
279595
279596
  return tool;
279596
279597
  }
@@ -393067,7 +393068,7 @@ var init_agentLoader = __esm({
393067
393068
  name: nameSchema,
393068
393069
  description: external_exports.string().min(1),
393069
393070
  display_name: external_exports.string().optional(),
393070
- tools: external_exports.array(external_exports.string().refine((val) => isValidToolName(val), {
393071
+ tools: external_exports.array(external_exports.string().refine((val) => isValidToolName(val, { allowWildcards: true }), {
393071
393072
  message: "Invalid tool name"
393072
393073
  })).optional(),
393073
393074
  model: external_exports.string().optional(),
@@ -398961,6 +398962,7 @@ var init_local_executor = __esm({
398961
398962
  init_geminiChat();
398962
398963
  init_node();
398963
398964
  init_tool_registry();
398965
+ init_tools();
398964
398966
  init_mcp_tool();
398965
398967
  init_turn();
398966
398968
  init_types3();
@@ -399008,18 +399010,40 @@ var init_local_executor = __esm({
399008
399010
  const agentToolRegistry = new ToolRegistry(runtimeContext, runtimeContext.getMessageBus());
399009
399011
  const parentToolRegistry = runtimeContext.getToolRegistry();
399010
399012
  const allAgentNames = new Set(runtimeContext.getAgentRegistry().getAllAgentNames());
399013
+ const registerToolInstance = (tool) => {
399014
+ if (allAgentNames.has(tool.name)) {
399015
+ debugLogger.warn(`[LocalAgentExecutor] Skipping subagent tool '${tool.name}' for agent '${definition.name}' to prevent recursion.`);
399016
+ return;
399017
+ }
399018
+ agentToolRegistry.registerTool(tool);
399019
+ };
399011
399020
  const registerToolByName = (toolName) => {
399012
- if (allAgentNames.has(toolName)) {
399013
- debugLogger.warn(`[LocalAgentExecutor] Skipping subagent tool '${toolName}' for agent '${definition.name}' to prevent recursion.`);
399021
+ if (toolName === "*") {
399022
+ for (const tool2 of parentToolRegistry.getAllTools()) {
399023
+ registerToolInstance(tool2);
399024
+ }
399014
399025
  return;
399015
399026
  }
399027
+ if (isMcpToolName(toolName)) {
399028
+ if (toolName === `${MCP_TOOL_PREFIX}*`) {
399029
+ for (const tool2 of parentToolRegistry.getAllTools()) {
399030
+ if (tool2 instanceof DiscoveredMCPTool) {
399031
+ registerToolInstance(tool2);
399032
+ }
399033
+ }
399034
+ return;
399035
+ }
399036
+ const parsed = parseMcpToolName(toolName);
399037
+ if (parsed.serverName && parsed.toolName === "*") {
399038
+ for (const tool2 of parentToolRegistry.getToolsByServer(parsed.serverName)) {
399039
+ registerToolInstance(tool2);
399040
+ }
399041
+ return;
399042
+ }
399043
+ }
399016
399044
  const tool = parentToolRegistry.getTool(toolName);
399017
399045
  if (tool) {
399018
- if (tool instanceof DiscoveredMCPTool) {
399019
- agentToolRegistry.registerTool(tool.asFullyQualifiedTool());
399020
- } else {
399021
- agentToolRegistry.registerTool(tool);
399022
- }
399046
+ registerToolInstance(tool);
399023
399047
  }
399024
399048
  };
399025
399049
  if (definition.toolConfig) {
@@ -399674,17 +399698,12 @@ var init_local_executor = __esm({
399674
399698
  const toolsList = [];
399675
399699
  const { toolConfig, outputConfig } = this.definition;
399676
399700
  if (toolConfig) {
399677
- const toolNamesToLoad = [];
399678
399701
  for (const toolRef of toolConfig.tools) {
399679
- if (typeof toolRef === "string") {
399680
- toolNamesToLoad.push(toolRef);
399681
- } else if (typeof toolRef === "object" && "schema" in toolRef) {
399682
- toolsList.push(toolRef.schema);
399683
- } else {
399702
+ if (typeof toolRef === "object" && !("schema" in toolRef)) {
399684
399703
  toolsList.push(toolRef);
399685
399704
  }
399686
399705
  }
399687
- toolsList.push(...this.toolRegistry.getFunctionDeclarationsFiltered(toolNamesToLoad));
399706
+ toolsList.push(...this.toolRegistry.getFunctionDeclarations());
399688
399707
  }
399689
399708
  const completeTool = {
399690
399709
  name: TASK_COMPLETE_TOOL_NAME,