check_feature
Verify if a specific feature is currently loaded or available within the Emacs environment.
Instructions
Check whether a specific feature is loaded or available.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| feature | Yes | Feature name to check. |
Implementation Reference
- src/tools.ts:59-64 (handler)The actual implementation of checkFeature function that evaluates Elisp to check if a feature is loaded using featurep. Takes a feature name string and returns the feature name if loaded or 'nil' if not.
export async function checkFeature(feature: string): Promise<string> { const result = await emacsEval( `(format "%s" (if (featurep (intern-soft ${quoteString(feature)})) ${quoteString(feature)} "nil"))` ); return stripQuotes(result); } - src/index.ts:23-23 (registration)Tool registration in the MCP server's ListToolsRequestSchema handler, defining the check_feature tool with its description and input schema.
{ name: "check_feature", description: "Check whether a specific feature is loaded or available.", inputSchema: { type: "object", properties: { feature: { type: "string", description: "Feature name to check." } }, required: ["feature"] } }, - src/index.ts:58-59 (registration)The switch case handler that routes check_feature tool calls to the tools.checkFeature function, extracting the feature argument and returning the result as text.
case "check_feature": return text(await tools.checkFeature(args.feature as string)); - dist/tools.d.ts:8-8 (schema)TypeScript type declaration for the checkFeature function, specifying it takes a feature string parameter and returns a Promise<string>.
export declare function checkFeature(feature: string): Promise<string>; - src/elisp.ts:1-6 (helper)The quoteString helper function used by checkFeature to safely escape strings for use in Elisp expressions.
export function quoteString(s: string): string { const escaped = s .replace(/\\/g, "\\\\") .replace(/"/g, '\\"') .replace(/\n/g, "\\n"); return `"${escaped}"`;