import { MCPTool } from "./index.js";
import { COMPONENTS_DB } from "../data/components.js";
export const getComponentDocTool: MCPTool = {
name: "get_ntv_component_doc",
description:
"Gets comprehensive documentation for a specific NTV component including props, events, and usage patterns",
inputSchema: {
type: "object",
properties: {
component: {
type: "string",
description:
"Component name (e.g., 'Button', 'Input', 'Card', 'Autocomplete')",
},
},
required: ["component"],
},
execute: async (args: Record<string, unknown>) => {
const componentName = args.component as string;
const component = COMPONENTS_DB.find(
(c) => c.name.toLowerCase() === componentName.toLowerCase()
);
if (!component) {
throw new Error(`Component '${componentName}' not found`);
}
return {
name: component.name,
selector: component.selector,
category: component.category,
description: component.description,
imports: `import { ${component.name} } from '@ntv-scaffolding/component-pantry';`,
props: component.props,
events: component.events || [],
slots: component.slots || [],
examples: component.examples || [],
bestPractices: component.bestPractices || [],
};
},
};