Skip to main content
Glama

init_spec_knowledge

Initialize a spec-knowledge.md file with EARS, INVEST, AC quality rules and TODO sections for team domain rules, actors, and glossary. Avoids overwriting existing files without explicit permission.

Instructions

Create SPEC_PROJECT_ROOT/spec-knowledge.md from a starter template. The file carries spec methodology (EARS, INVEST, AC quality rules) plus TODO sections for the team's domain rules / actors / glossary. Other mk-spec-master tools lean on this indirectly via get_spec_context. Idempotent — refuses to overwrite an existing file unless overwrite=true. Optional project_name labels the file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_nameNo
overwriteNo

Implementation Reference

  • The main handler function for the init_spec_knowledge tool. Takes arguments dict (project_name, overwrite), creates spec-knowledge.md from starter template. Idempotent - refuses to overwrite unless overwrite=True.
    def init_spec_knowledge_tool(arguments: dict) -> dict[str, Any]:
        """Create SPEC_PROJECT_ROOT/spec-knowledge.md from a starter template.
    
        Idempotent: refuses to clobber an existing file unless overwrite=True.
        """
        project_name = str(arguments.get("project_name") or config.PROJECT_ROOT.name)
        overwrite = bool(arguments.get("overwrite"))
    
        path = _knowledge_path()
        if path.exists() and not overwrite:
            return {
                "created": False,
                "path": str(path),
                "reason": "file already exists; pass overwrite=true to replace",
            }
    
        path.parent.mkdir(parents=True, exist_ok=True)
        path.write_text(_starter_content(project_name), encoding="utf-8")
        return {
            "created": True,
            "path": str(path),
            "bytes": path.stat().st_size,
        }
  • Input schema for init_spec_knowledge: project_name (string, optional) and overwrite (boolean, default False) defined in the MCP Tool registration.
    inputSchema={
        "type": "object",
        "properties": {
            "project_name": {"type": "string"},
            "overwrite": {"type": "boolean", "default": False},
        },
    },
  • MCP Tool registration for init_spec_knowledge with name, description, and inputSchema.
    Tool(
        name="init_spec_knowledge",
        description=(
            "Create SPEC_PROJECT_ROOT/spec-knowledge.md from a starter "
            "template. The file carries spec methodology (EARS, INVEST, "
            "AC quality rules) plus TODO sections for the team's domain "
            "rules / actors / glossary. Other mk-spec-master tools "
            "lean on this indirectly via get_spec_context. Idempotent "
            "— refuses to overwrite an existing file unless "
            "overwrite=true. Optional project_name labels the file."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "project_name": {"type": "string"},
                "overwrite": {"type": "boolean", "default": False},
            },
        },
    ),
  • Maps the string 'init_spec_knowledge' to the spec_knowledge_tools.init_spec_knowledge_tool handler function in the tool registry.
    "init_spec_knowledge": spec_knowledge_tools.init_spec_knowledge_tool,
  • Helper functions: _knowledge_path() returns the path to spec-knowledge.md, _starter_content(project_name) builds the full starter markdown content combining universal methodology and domain TODO sections.
    def _knowledge_path():
        return config.PROJECT_ROOT / "spec-knowledge.md"
    
    
    def _starter_content(project_name: str) -> str:
        return (
            f"# Spec knowledge — {project_name}\n\n"
            "> Methodology + domain glossary that mk-spec-master tools "
            "(`analyze_spec_quality`, `propose_spec_improvements`, "
            "`get_optimization_plan`) lean on indirectly. The AI client should "
            "call `get_spec_context` near the start of each session so the same "
            "rules colour every spec interpretation that follows.\n\n"
            + _UNIVERSAL_METHODOLOGY
            + "\n"
            + _DOMAIN_TODO_SECTIONS
        )
Behavior4/5

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

With no annotations provided, the description carries full burden. It discloses idempotency (refuses to overwrite unless overwrite=true) and the file's content purpose. It does not mention side effects or return values, but the key behavior is well-covered.

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 two sentences: the first states the primary action and content, the second covers idempotency and optional parameter. It is front-loaded and contains no unnecessary words.

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

Completeness4/5

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

Given the simple interface (2 optional params, no output schema, no annotations), the description covers the essential aspects: what it creates, its behavioral constraints, and parameter roles. It could mention the template origin or expected outcome, but is sufficiently complete for an init tool.

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

Parameters4/5

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

Schema description coverage is 0%, so description compensates by explaining both parameters: 'project_name' labels the file, and 'overwrite' controls idempotent behavior. This adds meaning beyond the schema's type definitions.

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

Purpose5/5

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

The description clearly states it creates a specific file (SPEC_PROJECT_ROOT/spec-knowledge.md) from a starter template, and distinguishes from sibling tools by noting that others lean on it indirectly via get_spec_context.

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

Usage Guidelines4/5

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

The description explains the idempotent behavior and the role of the overwrite parameter, and implies its use as the initial setup step for spec knowledge. However, it does not explicitly state when not to use it or provide direct comparisons to siblings.

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/kao273183/mk-spec-master'

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