Skip to main content
Glama

score_prompt

Score and rewrite coding prompts to improve clarity and effectiveness across 4 dimensions before sending to an AI. No API key or server required.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
raw_promptYes

Implementation Reference

  • The main handler function for the score_prompt tool. It applies all rule sets (efficiency, clarity, specificity, completeness) to the prompt, computes a total score and per-dimension breakdown using the scorer, and returns results including issues.
    export function scorePrompt(rawPrompt: string) {
      const rules = [
        ...applyEfficiencyRules(rawPrompt).results,
        ...applyClarityRules(rawPrompt).results,
        ...applySpecificityRules(rawPrompt).results,
        ...applyCompletenessRules(rawPrompt).results,
      ];
      const { total, breakdown } = computeScore(rules);
      return { total, breakdown, issues: rules };
    }
  • src/index.ts:17-22 (registration)
    Registration of the 'score_prompt' tool on the MCP server (stdio transport). Defines the schema: expects a single 'raw_prompt' string. Calls scorePrompt() and returns JSON output.
    server.tool("score_prompt",
      { raw_prompt: z.string() },
      async ({ raw_prompt }) => ({
        content: [{ type: "text", text: JSON.stringify(scorePrompt(raw_prompt), null, 2) }]
      })
    );
  • src/http.ts:22-27 (registration)
    Registration of the 'score_prompt' tool on the MCP server (HTTP/streamable transport). Same schema and handler logic as the stdio registration.
    server.tool("score_prompt",
      { raw_prompt: z.string() },
      async ({ raw_prompt }) => ({
        content: [{ type: "text", text: JSON.stringify(scorePrompt(raw_prompt), null, 2) }]
      })
    );
  • The computeScore function that calculates the total prompt score (out of 100) and per-dimension breakdown (each up to 25 points) based on penalties derived from rule violations.
    export function computeScore(rules: RuleResult[]): { total: number; breakdown: ScoreBreakdown } {
      const penalties: Record<string, number> = { clarity: 0, specificity: 0, completeness: 0, efficiency: 0 };
    
      for (const r of rules) {
        const maxPenalty = 25 / RULES_PER_DIMENSION[r.dimension];
        penalties[r.dimension] += maxPenalty * SEVERITY_WEIGHT[r.severity];
      }
    
      const breakdown: ScoreBreakdown = {
        clarity:      Math.round(Math.max(0, 25 - penalties.clarity)),
        specificity:  Math.round(Math.max(0, 25 - penalties.specificity)),
        completeness: Math.round(Math.max(0, 25 - penalties.completeness)),
        efficiency:   Math.round(Math.max(0, 25 - penalties.efficiency)),
      };
    
      const total = (Object.values(breakdown) as number[]).reduce((a, b) => a + b, 0);
      return { total, breakdown };
    }
  • Type definitions used by the scoring system: RuleResult (includes dimension, severity, message, fix_applied) and ScoreBreakdown (clarity, specificity, completeness, efficiency).
    export type Severity = "info" | "warn" | "critical";
    export type Dimension = "clarity" | "specificity" | "completeness" | "efficiency";
    
    export interface RuleResult {
      id: string;
      dimension: Dimension;
      severity: Severity;
      message: string;
      fix_applied: boolean;
    }
    
    export interface ScoreBreakdown {
      clarity: number;
      specificity: number;
      completeness: number;
      efficiency: number;
    }
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/saurabhjambure-pixel/vibe-prompt-mcp'

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