Ghost MCP Server

by MFYDev
Verified

get_close_matches

Finds and returns the closest matches to a given word from a list of possibilities using similarity scoring, with customizable cutoff and maximum matches. Useful for text comparisons and error correction.

Instructions

Use SequenceMatcher to return list of the best "good enough" matches.

word is a sequence for which close matches are desired (typically a string). possibilities is a list of sequences against which to match word (typically a list of strings). Optional arg n (default 3) is the maximum number of close matches to return. n must be > 0. Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities that don't score at least that similar to word are ignored. The best (no more than n) matches among the possibilities are returned in a list, sorted by similarity score, most similar first. >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"]) ['apple', 'ape'] >>> import keyword as _keyword >>> get_close_matches("wheel", _keyword.kwlist) ['while'] >>> get_close_matches("Apple", _keyword.kwlist) [] >>> get_close_matches("accept", _keyword.kwlist) ['except']

Input Schema

NameRequiredDescriptionDefault
cutoffNo
nNo
possibilitiesYes
wordYes

Input Schema (JSON Schema)

{ "properties": { "cutoff": { "default": 0.6, "title": "cutoff", "type": "string" }, "n": { "default": 3, "title": "n", "type": "string" }, "possibilities": { "title": "possibilities", "type": "string" }, "word": { "title": "word", "type": "string" } }, "required": [ "word", "possibilities" ], "title": "get_close_matchesArguments", "type": "object" }
ID: vor63xn7ky