Skip to main content
Glama

get_templates

Retrieve Laravel CRUD implementation templates to generate controllers, models, migrations, and other components for rapid development.

Instructions

Get implementation templates for CRUD operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_typeNoTemplate type to get, or "all" for everything

Implementation Reference

  • index.js:193-238 (registration)
    Tool registration for 'get_templates' with input schema and handler function definition
    server.registerTool(
      'get_templates',
      {
        description: 'Get implementation templates for CRUD operations',
        inputSchema: {
          template_type: z.enum(['all', 'controller', 'service', 'service_interface', 'model', 'request', 'resource', 'migration']).optional().describe('Template type to get, or "all" for everything'),
        },
      },
      async ({ template_type = 'all' }) => {
        const templatesPath = path.join(DOCS_PATH, 'ai/templates.md');
    
        if (!fs.existsSync(templatesPath)) {
          throw new Error('Templates documentation not found');
        }
    
        let content = fs.readFileSync(templatesPath, 'utf-8');
    
        if (template_type !== 'all') {
          const sections = {
            controller: '1. Controller Template',
            service: '3. Service Implementation Template',
            service_interface: '2. Service Interface Template',
            model: '4. Model Template',
            request: '5. Index Request Template',
            resource: '7. Resource Template',
            migration: '9. Migration Template',
          };
    
          const sectionStart = content.indexOf(sections[template_type]);
          const sectionEnd = content.indexOf('\n---', sectionStart + 1);
    
          if (sectionStart === -1) {
            throw new Error(`Template type '${template_type}' not found`);
          }
    
          content = content.slice(sectionStart, sectionEnd === -1 ? content.length : sectionEnd);
        }
    
        return {
          content: [{
            type: 'text',
            text: content,
          }],
        };
      }
    );
  • Input schema validation using zod enum for template_type parameter with options: all, controller, service, service_interface, model, request, resource, migration
    {
      description: 'Get implementation templates for CRUD operations',
      inputSchema: {
        template_type: z.enum(['all', 'controller', 'service', 'service_interface', 'model', 'request', 'resource', 'migration']).optional().describe('Template type to get, or "all" for everything'),
      },
  • Handler function that reads templates from docs/ai/templates.md, optionally filters by section based on template_type parameter, and returns the content as text
    async ({ template_type = 'all' }) => {
      const templatesPath = path.join(DOCS_PATH, 'ai/templates.md');
    
      if (!fs.existsSync(templatesPath)) {
        throw new Error('Templates documentation not found');
      }
    
      let content = fs.readFileSync(templatesPath, 'utf-8');
    
      if (template_type !== 'all') {
        const sections = {
          controller: '1. Controller Template',
          service: '3. Service Implementation Template',
          service_interface: '2. Service Interface Template',
          model: '4. Model Template',
          request: '5. Index Request Template',
          resource: '7. Resource Template',
          migration: '9. Migration Template',
        };
    
        const sectionStart = content.indexOf(sections[template_type]);
        const sectionEnd = content.indexOf('\n---', sectionStart + 1);
    
        if (sectionStart === -1) {
          throw new Error(`Template type '${template_type}' not found`);
        }
    
        content = content.slice(sectionStart, sectionEnd === -1 ? content.length : sectionEnd);
      }
    
      return {
        content: [{
          type: 'text',
          text: content,
        }],
      };
    }
  • Section mapping object that defines the headings for each template type in the templates.md file for filtering purposes
    const sections = {
      controller: '1. Controller Template',
      service: '3. Service Implementation Template',
      service_interface: '2. Service Interface Template',
      model: '4. Model Template',
      request: '5. Index Request Template',
      resource: '7. Resource Template',
      migration: '9. Migration Template',
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Get implementation templates', implying a read-only operation, but doesn't specify if it's safe, requires authentication, has rate limits, or what the return format looks like (e.g., code snippets, files). This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and appropriately sized for a simple tool, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., templates as text, files, or structured data), potential errors, or usage constraints. For a tool with no structured behavioral data, more detail is needed to ensure the agent can use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with a clear parameter 'template_type' and an enum list. The description mentions 'CRUD operations', which adds context about the templates' purpose, but doesn't provide additional semantics beyond what the schema already documents, such as default behavior or examples. With high schema coverage, a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'implementation templates for CRUD operations', making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_design_system' or 'get_domain_examples', which might also provide templates or examples, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_domain_examples' or 'get_quick_reference'. It lacks context on prerequisites, such as whether it's for specific frameworks or languages, and doesn't mention any exclusions or best practices for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pujandan/mcp-laravel'

If you have feedback or need assistance with the MCP directory API, please join our Discord server