fix(backend/copilot): use specific message for MCP tool blocks in UUID lookup

MCP tools have their own run_mcp_tool path — don't tell users they can
"only be used in agent graphs" when looking up an MCP block by UUID.
Also use block.id instead of raw query in all excluded-block messages.
This commit is contained in:
Zamil Majdy
2026-03-17 13:16:07 +07:00
parent d68de002f5
commit a7c13d676c

View File

@@ -135,9 +135,22 @@ class FindBlockTool(BaseTool):
block.block_type in COPILOT_EXCLUDED_BLOCK_TYPES
or block.id in COPILOT_EXCLUDED_BLOCK_IDS
):
if block.block_type == BlockType.MCP_TOOL:
return NoResultsResponse(
message=(
f"Block '{block.name}' (ID: {block.id}) is not "
"runnable through find_block/run_block. Use "
"run_mcp_tool instead."
),
suggestions=[
"Use run_mcp_tool to discover and run this MCP tool",
"Search for an alternative block by name",
],
session_id=session_id,
)
return NoResultsResponse(
message=(
f"Block '{block.name}' (ID: {query}) is not available "
f"Block '{block.name}' (ID: {block.id}) is not available "
"in CoPilot. It can only be used within agent graphs."
),
suggestions=[