Skip to main content
Glama

propose_spec_improvements

Generates a markdown coach plan with concrete rewrite suggestions to improve specifications. Groups findings by spec and issue type for PM review.

Instructions

Take analyze_spec_quality output and produce a PM-facing markdown coach plan grouping findings by spec and issue type, with concrete rewrite suggestions per finding. If analysis is not provided, runs analyze_spec_quality inline with the remaining arguments. Use this when a user says 'how do I improve this spec' or 'review my PRD'. Returns {markdown, actions[]}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysisNoOutput of analyze_spec_quality. If omitted, this tool runs the analysis itself.
spec_idNo
raw_textNo

Implementation Reference

  • The main handler function `propose_spec_improvements_tool` that takes analysis results (or raw text) and produces a markdown coach plan with grouped findings by spec and issue type, including severity badges, suggestions, and actionable items.
    def propose_spec_improvements_tool(arguments: dict) -> dict[str, Any]:
        """Take the output of analyze_spec_quality (or run it inline) and
        produce a markdown coach plan that PMs / spec authors can act on.
        """
        analysis = arguments.get("analysis")
        if not analysis:
            analysis = analyze_spec_quality_tool({k: v for k, v in arguments.items() if k != "analysis"})
    
        md_lines = ["# Spec quality coach", ""]
        total = analysis.get("total_findings", 0)
        md_lines.append(f"**{total} finding(s) across {analysis.get('specs_analyzed', 0)} spec(s).**")
        if total == 0:
            md_lines += ["", "🟢 No issues caught by current heuristics. Note this checks for **vague language**, **untestable implementation refs**, and **unclear role refs** — semantic correctness still needs human review."]
            return {"markdown": "\n".join(md_lines), "actions": []}
    
        actions: list[dict] = []
        for spec_result in analysis.get("results", []):
            if spec_result["finding_count"] == 0:
                continue
            md_lines.append("")
            md_lines.append(f"## `{spec_result['spec_id']}` — {spec_result.get('title') or ''}")
            md_lines.append(f"_score: {spec_result['score']}/100 · findings: {spec_result['finding_count']}_")
            md_lines.append("")
    
            grouped: dict[str, list[dict]] = {}
            for f in spec_result["findings"]:
                grouped.setdefault(f["issue"], []).append(f)
    
            for issue, items in grouped.items():
                severity = items[0].get("severity", "warn")
                badge = {"error": "🔴", "warn": "🟡", "info": "🔵"}.get(severity, "•")
                human_name = {
                    "vague_language": "Vague language",
                    "untestable_implementation_ref": "Untestable / implementation-detail AC",
                    "unclear_role_refs": "Unclear role references",
                }.get(issue, issue)
                md_lines.append(f"### {badge} {human_name}  *(×{len(items)})*")
                md_lines.append("")
                for f in items:
                    ac_label = f"`{f['ac_id']}`" if f.get("ac_id") else "_(spec-level)_"
                    md_lines.append(f"- {ac_label}: evidence — `{f['evidence']}`")
                    md_lines.append(f"  - **Suggestion:** {f['suggestion']}")
                    if f.get("ac_text"):
                        md_lines.append(f"  - **Source AC:** > {f['ac_text']}")
                md_lines.append("")
    
                actions.append(
                    {
                        "spec_id": spec_result["spec_id"],
                        "issue": issue,
                        "count": len(items),
                        "severity": severity,
                    }
                )
    
        return {
            "markdown": "\n".join(md_lines),
            "actions": actions,
        }
  • Tool registration with input schema — accepts optional `analysis` (object) or `spec_id`/`raw_text` (strings) and returns {markdown, actions[]}.
    Tool(
        name="propose_spec_improvements",
        description=(
            "Take analyze_spec_quality output and produce a PM-facing "
            "markdown coach plan grouping findings by spec and issue type, "
            "with concrete rewrite suggestions per finding. If `analysis` "
            "is not provided, runs analyze_spec_quality inline with the "
            "remaining arguments. Use this when a user says 'how do I "
            "improve this spec' or 'review my PRD'. "
            "Returns {markdown, actions[]}."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "analysis": {
                    "type": "object",
                    "description": "Output of analyze_spec_quality. If omitted, this tool runs the analysis itself.",
                },
                "spec_id": {"type": "string"},
                "raw_text": {"type": "string"},
            },
        },
  • Dispatch registration mapping the tool name 'propose_spec_improvements' to `quality_tools.propose_spec_improvements_tool`.
    "propose_spec_improvements": quality_tools.propose_spec_improvements_tool,
  • Tool object registration with name 'propose_spec_improvements' and description explaining it produces a PM-facing markdown coach plan.
    name="propose_spec_improvements",
  • Reference to `propose_spec_improvements` in the spec knowledge starter content, documenting the tool as one of the coach tools.
    "(`analyze_spec_quality`, `propose_spec_improvements`, "
    "`get_optimization_plan`) lean on indirectly. The AI client should "
Behavior2/5

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

No annotations exist. The description discloses that it can call analyze_spec_quality internally and returns {markdown, actions[]}, but lacks details on side effects, performance, error handling, or implications of running the analysis (e.g., cost, permissions).

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?

Two sentences, front-loaded with core action, followed by usage guidance and output format. No redundant information; every sentence adds value.

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 no output schema and moderate parameter count (3, one nested), the description sufficiently explains functionality, input flexibility, usage scenarios, and output structure. Minor gap: no details on error conditions or input validation.

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 coverage is 33% (only 'analysis' described). The description adds context: if 'analysis' omitted, it uses 'spec_id' and 'raw_text' to run analysis inline. This clarifies parameter usage but doesn't detail each parameter's format or constraints.

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 the tool's function: taking analyze_spec_quality output to produce a PM-facing markdown coach plan with rewrite suggestions. It distinguishes from sibling tools like analyze_spec_quality by noting it can run the analysis itself if needed.

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 explicitly says 'Use this when a user says how do I improve this spec or review my PRD', providing clear when-to-use guidance. It also clarifies that missing analysis triggers inline execution, but does not mention when not to use it.

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