import { MCPTool } from "./index.js";
import { COMPONENTS_DB } from "../data/components.js";
export const getComponentPropsToolDefinition: MCPTool = {
name: "get_ntv_component_props",
description:
"Get detailed information about a component's input properties and configuration options",
inputSchema: {
type: "object",
properties: {
component: {
type: "string",
description: "Component name (e.g., 'Button', 'Input')",
},
propName: {
type: "string",
description: "Optional: Get details for a specific property",
},
},
required: ["component"],
},
execute: async (args: Record<string, unknown>) => {
const componentName = args.component as string;
const propName = args.propName as string | undefined;
const component = COMPONENTS_DB.find(
(c) => c.name.toLowerCase() === componentName.toLowerCase()
);
if (!component) {
throw new Error(`Component '${componentName}' not found`);
}
if (propName) {
const prop = component.props.find(
(p) => p.name.toLowerCase() === propName.toLowerCase()
);
if (!prop) {
throw new Error(
`Property '${propName}' not found on component '${componentName}'`
);
}
return { component: componentName, property: prop };
}
return {
component: componentName,
properties: component.props,
configInterface: component.configInterface || null,
};
},
};