Skip to main content
Glama

apply_auto_corrections

Fix text by applying auto-correction patterns from a chosen tool context, using persistent syntax rules and best practices that carry over across chat sessions.

Instructions

Apply auto-correction patterns from matching contexts to text

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText to apply corrections to
tool_nameYesTool context to use for corrections

Implementation Reference

  • Engine delegate method that calls contextMatcher.getAutoCorrections() to fetch correction rules for the given tool.
    getAutoCorrections(tool: string) {
      return this.contextMatcher.getAutoCorrections(this.contexts, tool);
    }
  • Core logic: matches contexts to the given tool, iterates their auto_corrections, and returns an array of {name, pattern, replacement} objects.
    getAutoCorrections(
      contexts: Map<string, Context>,
      tool: string,
    ): Array<{ name: string; pattern: string; replacement: string }> {
      const matches = this.match(contexts, { tool });
      const corrections: Array<{
        name: string;
        pattern: string;
        replacement: string;
      }> = [];
    
      for (const { context } of matches) {
        if (!context.auto_convert || !context.auto_corrections) continue;
    
        for (const [name, correction] of Object.entries(
          context.auto_corrections,
        )) {
          corrections.push({
            name,
            pattern: correction.pattern,
            replacement: correction.replacement,
          });
        }
      }
    
      return corrections;
    }
  • Zod schema for AutoCorrection: validates pattern (min 1 char) and replacement strings.
    export const AutoCorrectionSchema = z.object({
      pattern: z.string().min(1),
      replacement: z.string(),
    });
  • TypeScript interface for AutoCorrection with pattern (regex) and replacement (supports capture group refs).
    export interface AutoCorrection {
      /** Regex pattern to match. */
      pattern: string;
    
      /** Replacement string (supports capture group refs: $1, $2). */
      replacement: string;
    }
Behavior2/5

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

With no annotations, the description must disclose behavioral traits but only states the high-level purpose. It does not mention whether the operation is read-only or destructive, what happens on failure, or any side effects like modifying underlying data.

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

Conciseness3/5

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

The description is a single short sentence, concise but lacking detail. It could be expanded while remaining efficient, e.g., by explaining the correction process or output.

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 no output schema, the description should describe return values, but it does not. The tool has two required string parameters, and the description is too minimal to fully guide an agent on how to use it correctly.

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 100% with clear parameter descriptions. The tool description adds 'from matching contexts' which loosely ties to the tool_name parameter, but does not provide additional semantic value beyond the schema.

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 that the tool applies auto-correction patterns from matching contexts to text, which is a specific verb and resource. It distinguishes from siblings like 'get_syntax_rules' or 'list_available_contexts' by focusing on application rather than retrieval.

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?

No guidance is provided on when to use this tool versus alternatives such as 'build_injection' or 'approve_instinct'. There is no mention of prerequisites or context-matching steps, leaving the agent to infer usage.

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/doobidoo/MCP-Context-Provider'

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