improvement(mcp): restructure mcp tools caching/fetching info to improve UX (#2416)

* feat(mcp): improve cache practice

* restructure mcps fetching, caching, UX indicators

* fix schema

* styling improvements

* fix tooltips and render issue

* fix loading sequence + add redis

---------

Co-authored-by: waleed <walif6@gmail.com>
This commit is contained in:
Vikhyath Mondreti
2025-12-16 21:23:18 -08:00
committed by GitHub
parent b7228d57f7
commit de330d80f5
31 changed files with 9087 additions and 337 deletions

View File

@@ -107,6 +107,7 @@ const MCP_SYSTEM_PARAMETERS = new Set([
'workflowVariables',
'blockData',
'blockNameMapping',
'_toolSchema',
])
/**
@@ -979,7 +980,10 @@ async function executeMcpTool(
}
}
const requestBody = {
// Get tool schema if provided (from agent block's cached schema)
const toolSchema = params._toolSchema
const requestBody: Record<string, any> = {
serverId,
toolName,
arguments: toolArguments,
@@ -987,6 +991,11 @@ async function executeMcpTool(
workspaceId, // Pass workspace context for scoping
}
// Include schema to skip discovery on execution
if (toolSchema) {
requestBody.toolSchema = toolSchema
}
const body = JSON.stringify(requestBody)
// Check request body size before sending
@@ -995,6 +1004,7 @@ async function executeMcpTool(
logger.info(`[${actualRequestId}] Making MCP tool request to ${toolName} on ${serverId}`, {
hasWorkspaceId: !!workspaceId,
hasWorkflowId: !!workflowId,
hasToolSchema: !!toolSchema,
})
const response = await fetch(`${baseUrl}/api/mcp/tools/execute`, {