Add and improve JSDoc comments for core tool methods (#3128)

This commit is contained in:
moon jooho
2025-07-04 09:13:02 +09:00
committed by GitHub
parent 654f8aeb61
commit 8d3fec08e5
7 changed files with 55 additions and 6 deletions

View File

@@ -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;