Skip to content

Conversation

@Barbapapazes
Copy link
Contributor

@Barbapapazes Barbapapazes commented Nov 17, 2025

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Heyyyy πŸ‘‹,

This introduce the Nuxt UI Agent as a MCP tool.

When asking an Agent a query like "How to install Nuxt UI in a Vue project", it will list all pages and then read the installation page. This will completely fill the context with a lot of useless content. By using an Agent as a tool, the main Agent will query the second (Nuxt UI Agent) with the user query (or an improved version) and then returned only the useful content.

At the end, I'm sure that most of the tool could be disabled (from a end-user point of view) except the Ask Nuxt UI Agent.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@github-actions github-actions bot added the v4 #4488 label Nov 17, 2025
@HugoRCD HugoRCD self-requested a review November 17, 2025 15:13
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 17, 2025

npm i https://pkg.pr.new/@nuxt/ui@5476

commit: 7cd42a2


return streamText({
// Remove the ask_nuxt_ui_agent tool to avoid infinite loops
delete tools['ask_nuxt_ui_agent']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ask_nuxt_ui_agent tool is being removed unconditionally, which prevents the main agent from ever accessing it. The deletion should only occur when handling non-streaming requests from the MCP agent itself.

View Details
πŸ“ Patch Details
diff --git a/docs/server/api/search.ts b/docs/server/api/search.ts
index ab4607c7..4899a046 100644
--- a/docs/server/api/search.ts
+++ b/docs/server/api/search.ts
@@ -14,9 +14,6 @@ export default defineEventHandler(async (event) => {
   })
   const tools = await httpClient.tools()
 
-  // Remove the ask_nuxt_ui_agent tool to avoid infinite loops
-  delete tools['ask_nuxt_ui_agent']
-
   const options = {
     model: gateway('anthropic/claude-sonnet-4.5'),
     maxOutputTokens: 10_000,
@@ -48,6 +45,9 @@ Guidelines:
 
   // If not streaming, it's called from the MCP route as a tool.
   if (stream === false) {
+    // Remove the ask_nuxt_ui_agent tool to avoid infinite loops
+    delete tools['ask_nuxt_ui_agent']
+
     const { text } = await generateText({
       ...options,
       tools

Analysis

ask_nuxt_ui_agent tool unconditionally removed, blocking main agent delegation

What fails: The main agent cannot delegate Nuxt UI queries to the specialized Nuxt UI agent because the ask_nuxt_ui_agent tool is unconditionally deleted before the streaming/non-streaming path check.

How to reproduce:

  1. Call /api/search endpoint with user query (default stream=true)
  2. LLM attempts to use ask_nuxt_ui_agent tool for Nuxt UI questions
  3. Tool is unavailable in the tools object despite being registered in the MCP server

Result: Main agent cannot delegate - tool deletion on line 18 removes it before the streaming check, preventing streaming requests from accessing it. Tool is missing from both streaming (stream=true) and non-streaming (stream=false) paths when it should only be missing from non-streaming requests.

Expected: The tool deletion should only occur for non-streaming requests (stream=false) from the MCP agent itself. Streaming requests should have full access to all MCP tools including ask_nuxt_ui_agent to enable proper delegation. The tool prevents infinite loops only when the MCP agent calls back with stream=false.

Fix applied: Moved delete tools['ask_nuxt_ui_agent'] from line 18 (unconditional) into the if (stream === false) block (conditional), so the main agent retains tool access while MCP callbacks are protected from recursion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, always remove this tool.

When using the MCP, the tool ask_nuxt_ui_agent is available. This tool will fetch /api/search that will connect to the MCP to get tools. In that case, the tool ask_nuxt_ui_agent must be removed.

@benjamincanac benjamincanac changed the title feat(mcp): nuxt ui agent as a mcp tool docs(mcp): add nuxt ui agent as a mcp tool Nov 17, 2025
@sandros94
Copy link
Member

I still think that a parser for the md content would be simpler to both manage and scale. Such as a tool that would request one or multiple docs pages, then extract specific sections like usage, slots, theme and so on.

Tho this mostly comes from personal experience when we were on UI v3 and with the old Nuxt MCP which did not correctly stream responses, thus timing out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants