get_ntv_component_examples
Retrieve predefined usage examples and code snippets for specific Angular components to understand implementation patterns and accelerate development.
Instructions
Gets predefined usage examples and code snippets for a specific component
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"component": "<component>"
},
"name": "get_ntv_component_examples"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| component | Yes | Component name (e.g., 'Button', 'Input') | |
| includeCode | No | Include full code snippets in response. Default: true |
Implementation Reference
- src/tools/getComponentExamples.ts:22-48 (handler)The execute function implementing the tool logic: finds the component in COMPONENTS_DB, retrieves and formats its examples based on the includeCode parameter, and returns structured data.
execute: async (args: Record<string, unknown>) => { const componentName = args.component as string; const includeCode = args.includeCode !== false; const component = COMPONENTS_DB.find( (c) => c.name.toLowerCase() === componentName.toLowerCase() ); if (!component) { throw new Error(`Component '${componentName}' not found`); } const examples = component.examples || []; const formattedExamples = examples.map((example: any) => ({ title: example.title, description: example.description, template: includeCode ? example.template : undefined, component: includeCode ? example.component : undefined, notes: example.notes, })); return { component: componentName, exampleCount: formattedExamples.length, examples: formattedExamples, }; }, - Input schema defining the parameters: component (required string) and optional includeCode (boolean).
inputSchema: { type: "object", properties: { component: { type: "string", description: "Component name (e.g., 'Button', 'Input')", }, includeCode: { type: "boolean", description: "Include full code snippets in response. Default: true", }, }, required: ["component"], }, - src/tools/index.ts:17-26 (registration)The getComponentExamplesTool is registered in the componentTools array, imported on line 7, which is used by the MCP server to list and call tools.
export const componentTools: MCPTool[] = [ generateComponentTool, getComponentDocTool, listComponentsTool, generateComponentUsageTool, getComponentPropsToolDefinition, generateTemplateCodeTool, getComponentExamplesTool, getComponentUsagePatternTool, ];