Skip to content

Conversation

@BerzinsU
Copy link

@BerzinsU BerzinsU commented Nov 4, 2025

❓ 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

Added additional tools to MCP, so it can retrieve only sections for components, like, theme, or slots.

  • list_component_sections - lists available sections for a component
  • get_component_sections - fetches only specified sections
  • Enhanced get_component with optional sections parameter

I'm in a middle of a large migration and tried to connect MCP server to help me out with it, but it fetches whole docs for components, when it actually needs to learn the new slot names, or how themes structure has changed for specific components. For example, fetching table docs alone throws warnings about token count.

Claude says it could save him 70-90% of tokens. πŸ˜…

πŸ“ 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 4, 2025

for (let i = 0; i < lines.length; i++) {
const line = lines[i]
if (!line) continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty lines are being skipped even when inside target sections, which will break markdown formatting by removing important blank lines.

View Details
πŸ“ Patch Details
diff --git a/docs/server/utils/parseMarkdownSections.ts b/docs/server/utils/parseMarkdownSections.ts
index 60b0f533..603a40a5 100644
--- a/docs/server/utils/parseMarkdownSections.ts
+++ b/docs/server/utils/parseMarkdownSections.ts
@@ -35,7 +35,7 @@ export function parseMarkdownSections(markdown: string, sections: string[]): Rec
 
   for (let i = 0; i < lines.length; i++) {
     const line = lines[i]
-    if (!line) continue
+    if (!line && !inTargetSection) continue
 
     // Check if this is a heading line
     const headingMatch = line.match(/^(#{1,6}) +(\S.*)$/)
@@ -79,8 +79,8 @@ export function parseMarkdownSections(markdown: string, sections: string[]): Rec
           currentContent.push(line)
         }
       }
-    } else if (inTargetSection && line) {
-      // We're in a target section, capture the line
+    } else if (inTargetSection) {
+      // We're in a target section, capture the line (including empty lines)
       currentContent.push(line)
     }
   }

Analysis

Empty lines stripped from target markdown sections in parseMarkdownSections()

What fails: The parseMarkdownSections() function in docs/server/utils/parseMarkdownSections.ts removes all empty lines from extracted sections, breaking markdown formatting for paragraphs, code blocks, and lists.

How to reproduce:

import { parseMarkdownSections } from './docs/server/utils/parseMarkdownSections.ts'

const markdown = `## Props

Paragraph 1

Paragraph 2

\`\`\`typescript
code block

with empty line
\`\`\``

const result = parseMarkdownSections(markdown, ['props'])
console.log(result.props) // Empty lines missing

Result: Extracted sections have all empty lines removed, collapsing paragraphs and breaking code block formatting

Expected: Empty lines should be preserved within target sections to maintain proper markdown structure and readability

Root cause: Line 38 if (!line) continue skips empty lines before checking inTargetSection status, and line 81 else if (inTargetSection && line) only captures non-empty lines

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 4, 2025

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

commit: b26abe3

@HugoRCD HugoRCD self-requested a review November 4, 2025 22:08
@HugoRCD
Copy link
Member

HugoRCD commented Nov 4, 2025

@BerzinsU I totally agree that some components are extremely long and probably overload the context of some models. However, I don't think the solution is to add more tools, but rather to modify and improve the existing ones. I'll try to investigate this!

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