Skip to main content
Glama

analyze_prompt

Evaluate prompt quality and get actionable improvement suggestions by assessing clarity, specificity, structure, and actionability with specific scores and recommendations.

Instructions

Evaluate prompt quality and get actionable improvement suggestions.

Use this tool when you need to: • Assess if a prompt is well-structured • Identify weaknesses before using a prompt • Get specific suggestions for improvement • Compare prompt quality before/after refinement

Returns scores (0-100) for: clarity, specificity, structure, actionability.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesThe prompt to analyze.
evaluationCriteriaNoSpecific criteria to evaluate. Default: all criteria.

Implementation Reference

  • Core handler function for the analyze_prompt tool. Analyzes prompt quality using API when available, with comprehensive fallback rule-based scoring and suggestions.
    export async function analyzePrompt(input: AnalyzePromptInput): Promise<AnalysisResult> {
      const { prompt, evaluationCriteria = DEFAULT_CRITERIA } = input;
      
      logger.info('Analyzing prompt', { 
        promptLength: prompt.length,
        criteria: evaluationCriteria 
      });
    
      // Calculate structural metadata (always needed)
      const metadata = calculateMetadata(prompt);
    
      // Use PromptArchitect API
      if (isApiClientAvailable()) {
        try {
          const response = await apiAnalyzePrompt({
            prompt,
            evaluationCriteria,
          });
          
          logger.info('Analyzed via PromptArchitect API');
          
          return {
            scores: {
              overall: response.overallScore,
              clarity: response.scores.clarity,
              specificity: response.scores.specificity,
              structure: response.scores.structure,
              actionability: response.scores.actionability,
            },
            suggestions: response.suggestions || [],
            strengths: response.strengths || identifyStrengths(prompt, metadata),
            weaknesses: response.weaknesses || identifyWeaknesses(prompt, metadata),
            metadata,
          };
        } catch (error) {
          logger.warn('API request failed, using fallback', { 
            error: error instanceof Error ? error.message : 'Unknown error' 
          });
        }
      }
    
      // Fallback rule-based analysis
      logger.warn('Using fallback rule-based analysis');
      return performRuleBasedAnalysis(prompt, metadata);
    }
  • Zod schema defining input validation for the analyze_prompt tool.
    export const analyzePromptSchema = z.object({
      prompt: z.string().min(1).describe('The prompt to analyze'),
      evaluationCriteria: z.array(z.string()).optional().describe('Specific criteria to evaluate'),
    });
  • src/server.ts:233-244 (registration)
    MCP server request handler registration for calling the analyze_prompt tool.
    case 'analyze_prompt': {
      const input = analyzePromptSchema.parse(args);
      const result = await analyzePrompt(input);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/server.ts:155-181 (registration)
    Tool metadata registration in MCP listTools handler, including description and input schema.
            {
              name: 'analyze_prompt',
              description: `Evaluate prompt quality and get actionable improvement suggestions.
    
    Use this tool when you need to:
    • Assess if a prompt is well-structured
    • Identify weaknesses before using a prompt
    • Get specific suggestions for improvement
    • Compare prompt quality before/after refinement
    
    Returns scores (0-100) for: clarity, specificity, structure, actionability.`,
              inputSchema: {
                type: 'object',
                properties: {
                  prompt: {
                    type: 'string',
                    description: 'The prompt to analyze.',
                  },
                  evaluationCriteria: {
                    type: 'array',
                    items: { type: 'string' },
                    description: 'Specific criteria to evaluate. Default: all criteria.',
                  },
                },
                required: ['prompt'],
              },
            },
Behavior3/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. It discloses that the tool returns scores (0-100) for clarity, specificity, structure, and actionability, which adds behavioral context beyond basic functionality. However, it does not cover other traits like error handling, performance, or limitations, leaving gaps in transparency for a tool with no annotation support.

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 appropriately sized and front-loaded: it starts with a clear purpose statement, followed by bullet points for usage guidelines and a summary of return values. Every sentence earns its place by adding value without redundancy, making it efficient and well-structured.

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 tool's moderate complexity, no annotations, and no output schema, the description does a good job by explaining the purpose, usage, and return values. It covers key aspects like what the tool does and what it outputs, but lacks details on error cases or advanced behavioral traits, which would be needed for full completeness in the absence of structured data.

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 documents both parameters: 'prompt' and 'evaluationCriteria.' The description does not add any meaning beyond this, such as explaining what constitutes a 'prompt' or detailing the criteria options. With high schema coverage, the baseline is 3, as the description provides no extra parameter insights.

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: 'Evaluate prompt quality and get actionable improvement suggestions.' It specifies the verb 'evaluate' and resource 'prompt quality,' but does not explicitly differentiate it from sibling tools like 'refine_prompt' or 'generate_prompt,' which might involve similar prompt-related tasks. This makes it clear but not fully distinct from alternatives.

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 provides clear usage contexts with bullet points: 'Assess if a prompt is well-structured,' 'Identify weaknesses before using a prompt,' 'Get specific suggestions for improvement,' and 'Compare prompt quality before/after refinement.' It gives explicit when-to-use guidance but does not mention when not to use it or name specific alternatives like 'refine_prompt,' which could be a follow-up action.

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/MerabyLabs/promptarchitect-mcp'

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