Skip to main content
Glama

apply_auto_corrections

Apply auto-correction patterns from matching contexts to text, ensuring consistent formatting and syntax across conversations.

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

  • The handler for the apply_auto_corrections tool, which uses engine.getAutoCorrections to retrieve and apply corrections.
    case 'apply_auto_corrections': {
      const text = String(args?.['text'] ?? '');
      const toolName = String(args?.['tool_name'] ?? '');
      if (!text || !toolName) {
        return {
          content: [{ type: 'text', text: 'Error: text and tool_name are required' }],
        };
      }
      const corrections = engine.getAutoCorrections(toolName);
      let result = text;
      const applied: string[] = [];
      for (const c of corrections) {
        const re = new RegExp(c.pattern, 'gi');
        if (re.test(result)) {
          result = result.replace(re, c.replacement);
          applied.push(c.name);
        }
      }
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(
              { corrected_text: result, corrections_applied: applied },
              null,
              2,
            ),
          },
        ],
      };
    }
  • Registration of the apply_auto_corrections tool in the ListToolsRequestSchema.
      name: 'apply_auto_corrections',
      description: 'Apply auto-correction patterns from matching contexts to text',
      inputSchema: {
        type: 'object' as const,
        properties: {
          text: { type: 'string', description: 'Text to apply corrections to' },
          tool_name: {
            type: 'string',
            description: 'Tool context to use for corrections',
          },
        },
        required: ['text', 'tool_name'],
      },
    },

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