Skip to main content
Glama

generate_cursor_rules

Create .cursorrules files for Cursor AI by analyzing project stacks including programming languages, frameworks, and databases to configure AI coding assistance.

Instructions

Generates a .cursorrules file for Cursor AI based on the project stack.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYesName of the project
languagesYesProgramming languages used (e.g., ['typescript', 'python'])
frameworksNoFrameworks used (e.g., ['react', 'fastapi'])
databasesNoDatabases used (e.g., ['postgresql', 'redis'])

Implementation Reference

  • The handler function that implements the core logic of the 'generate_cursor_rules' tool, generating a .cursorrules file content based on project name, languages, frameworks, and databases.
    export function generateCursorRulesHandler(args: any) {
        const { projectName, languages, frameworks = [], databases = [] } = args;
    
        const content = `# ${projectName} - Cursor Rules
    
    ## Project Overview
    This is a ${languages.join("/")} project${frameworks.length ? ` using ${frameworks.join(", ")}` : ""}.
    
    ## Code Style
    - Follow ${languages[0]} best practices and style guides
    - Use consistent naming conventions
    - Write self-documenting code with clear variable names
    - Keep functions small and focused (< 50 lines)
    
    ## Architecture
    - Separate concerns clearly (MVC, Clean Architecture, etc.)
    - Use dependency injection where applicable
    - Keep business logic separate from I/O
    
    ## Testing
    - Write unit tests for all business logic
    - Use integration tests for API endpoints
    - Aim for > 80% code coverage
    
    ## Error Handling
    - Use structured error handling
    - Log errors with appropriate context
    - Return meaningful error messages to users
    
    ## Security
    - Never commit secrets or API keys
    - Validate all user input
    - Use parameterized queries for databases
    ${databases.length ? `\n## Database (${databases.join(", ")})\n- Use connection pooling\n- Handle transactions properly\n- Avoid N+1 queries` : ""}
    
    ## Documentation
    - Document all public APIs
    - Keep README up to date
    - Use inline comments for complex logic only
    `;
    
        return {
            content: [{ type: "text", text: content }]
        };
    }
  • Zod-based input schema definition for the 'generate_cursor_rules' tool, specifying parameters like projectName, languages, frameworks, and databases.
    export const generateCursorRulesSchema = {
        name: "generate_cursor_rules",
        description: "Generates a .cursorrules file for Cursor AI based on the project stack.",
        inputSchema: z.object({
            projectName: z.string().describe("Name of the project"),
            languages: z.array(z.string()).describe("Programming languages used (e.g., ['typescript', 'python'])"),
            frameworks: z.array(z.string()).optional().describe("Frameworks used (e.g., ['react', 'fastapi'])"),
            databases: z.array(z.string()).optional().describe("Databases used (e.g., ['postgresql', 'redis'])")
        })
    };
  • src/index.ts:95-95 (registration)
    Registration of the 'generate_cursor_rules' tool in the toolRegistry Map used by the main stdio MCP server.
    ["generate_cursor_rules", { schema: generateCursorRulesSchema, handler: generateCursorRulesHandler }],
  • src/server.ts:106-106 (registration)
    Registration of the 'generate_cursor_rules' tool in the toolRegistry Map used by the HTTP MCP server.
    ["generate_cursor_rules", { schema: generateCursorRulesSchema, handler: generateCursorRulesHandler }],
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool generates a file but doesn't disclose behavioral traits like: whether it creates/overwrites files, what format the output takes, if it requires specific permissions, or how it handles errors. For a file generation tool with zero annotation coverage, this leaves significant behavioral unknowns.

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 states the core purpose without unnecessary elaboration. It's appropriately sized for this tool's complexity and front-loads the essential information. Every word earns its place.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, file generation), no annotations, and no output schema, the description is minimally adequate but has clear gaps. It identifies what the tool produces but doesn't explain the output format, file location, or how the generated rules function. For a configuration generation tool among many similar siblings, more contextual differentiation would be helpful.

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?

Schema description coverage is 100%, so the schema already fully documents all 4 parameters. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain how these inputs affect the generated rules, provide examples of complete configurations, or clarify relationships between parameters. Baseline 3 is appropriate when schema does all the work.

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 tool's purpose: 'Generates a .cursorrules file for Cursor AI based on the project stack.' It specifies the verb ('Generates'), resource ('.cursorrules file'), and context ('based on the project stack'). However, it doesn't explicitly differentiate from sibling tools like 'generate_claude_config' or 'generate_copilot_config' which appear to be similar configuration generators for other AI tools.

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. With multiple sibling tools that generate configurations for different AI assistants (Claude, Copilot, Cline, etc.), there's no indication of when Cursor AI rules are appropriate versus other AI tool configurations. No prerequisites, exclusions, or comparative context is provided.

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/millsydotdev/Code-MCP'

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