Skip to main content
Glama

generate_emacs_lisp_code

Automate Emacs tasks by generating Elisp code for specified purposes using the Emacs MCP Server. Simplify interaction and control within Emacs through AI-driven code creation.

Instructions

Generate Emacs Lisp code for the given purpose.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
purposeYes

Implementation Reference

  • The primary handler function for the 'generate_emacs_lisp_code' MCP tool. It is registered via the @mcp.tool() decorator and delegates execution to the helper function after logging.
    @log_execution
    @mcp.tool()
    def generate_emacs_lisp_code(purpose: str) -> str:
        """Generate Emacs Lisp code for the given purpose."""
        return generate_emacs_lisp_code_from_llm(purpose)
  • Supporting helper function decorated with @llmify to generate Emacs Lisp code using an LLM, based on the provided purpose.
    @log_execution
    @llmify
    def generate_emacs_lisp_code_from_llm(purpose: str):
        """Generate Emacs Lisp code for the following purpose: {{ purpose }}.
    
        Make sure to include a docstring in the code, and insert explanatory comments.
    
        MAKE SURE TO ONLY RETURN THE CODE, DO NOT RETURN ANY EXPLANATION OR ADDITIONAL TEXT.
    
        DO NOT WRAP THE CODE IN MARKDOWN CODE BLOCKS.
        """
        pass
Behavior1/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. However, it only states what the tool does without any details on behavioral traits such as whether it's a read-only or destructive operation, authentication needs, rate limits, or what the output looks like. This makes it inadequate for informing the agent about how the tool behaves beyond its basic function.

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 extremely concise and front-loaded, consisting of a single sentence that directly states the tool's purpose. There is no wasted language or unnecessary elaboration, making it efficient and easy to parse. This is an example of optimal conciseness for a simple tool.

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 tool's complexity (code generation), lack of annotations, no output schema, and low parameter documentation, the description is incomplete. It doesn't provide enough context for the agent to understand how to use the tool effectively, such as what the generated code looks like, any limitations, or how it differs from executing code. This gap makes it insufficient for a tool with these characteristics.

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

Parameters2/5

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

The input schema has 1 parameter with 0% description coverage, meaning the schema provides no details about the 'purpose' parameter. The description adds minimal semantics by implying the parameter is for specifying the purpose of the code generation, but it doesn't explain what format or content is expected, examples, or constraints. This leaves the parameter poorly documented, failing to compensate for the low schema coverage.

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: 'Generate Emacs Lisp code for the given purpose.' It specifies the verb ('Generate'), resource ('Emacs Lisp code'), and input ('given purpose'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from its sibling tool 'execute_emacs_lisp_code', which is why it doesn't score a 5.

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 its sibling 'execute_emacs_lisp_code'. It doesn't mention any prerequisites, alternatives, or exclusions, leaving the agent to infer usage based on the tool name alone. This lack of explicit guidance reduces its effectiveness in helping the agent select the correct tool.

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

Related 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/vivekhaldar/emacs-mcp-server'

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