summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/mcp-client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/core/src/tools/mcp-client.ts')
-rw-r--r--packages/core/src/tools/mcp-client.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/core/src/tools/mcp-client.ts b/packages/core/src/tools/mcp-client.ts
index 52196b80..359ce30a 100644
--- a/packages/core/src/tools/mcp-client.ts
+++ b/packages/core/src/tools/mcp-client.ts
@@ -162,6 +162,16 @@ export async function discoverMcpTools(
}
}
+/**
+ * Connects to an MCP server and discovers available tools, registering them with the tool registry.
+ * This function handles the complete lifecycle of connecting to a server, discovering tools,
+ * and cleaning up resources if no tools are found.
+ *
+ * @param mcpServerName The name identifier for this MCP server
+ * @param mcpServerConfig Configuration object containing connection details
+ * @param toolRegistry The registry to register discovered tools with
+ * @returns Promise that resolves when discovery is complete
+ */
async function connectAndDiscover(
mcpServerName: string,
mcpServerConfig: MCPServerConfig,
@@ -375,6 +385,13 @@ async function connectAndDiscover(
}
}
+/**
+ * Sanitizes a JSON schema object to ensure compatibility with Vertex AI.
+ * This function recursively processes the schema to remove problematic properties
+ * that can cause issues with the Gemini API.
+ *
+ * @param schema The JSON schema object to sanitize (modified in-place)
+ */
export function sanitizeParameters(schema?: Schema) {
if (!schema) {
return;