Skip to main content
Glama

grep_controls_in_markdown

Search markdown files for FedRAMP security control identifiers to locate compliance documentation and guidance within FedRAMP documentation.

Instructions

Search markdown files for occurrences of a control identifier.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
controlYes
with_enhancementsNo

Implementation Reference

  • The execute handler for the 'grep_controls_in_markdown' tool. It receives input and calls the core grepControlsInMarkdown function with the control and enhancements flag.
    execute: async (input) => { const matches = grepControlsInMarkdown( input.control, input.with_enhancements ?? true, ); return { matches }; },
  • Zod input schema defining 'control' (string) and 'with_enhancements' (boolean, default true).
    const schema = z.object({ control: z.string(), with_enhancements: z.boolean().default(true), });
  • Core helper function that implements the grep logic: searches indexed markdown documents for control occurrences using regex, with optional enhancement matching (e.g., with params).
    export function grepControlsInMarkdown( control: string, withEnhancements: boolean, ): Array<{ path: string; line: number; snippet: string }> { const docs = getIndexState().markdownDocs; const escaped = escapeStringRegexp(control); const controlRegex = withEnhancements ? new RegExp(`${escaped}(\\([^)]+\\))?`, "g") : new RegExp(`${escaped}(?!\\()`, "g"); const matches: Array<{ path: string; line: number; snippet: string }> = []; for (const doc of docs.values()) { doc.lines.forEach((line, idx) => { if (controlRegex.test(line)) { matches.push({ path: doc.path, line: idx + 1, snippet: line.trim().slice(0, 240), }); } controlRegex.lastIndex = 0; }); } return matches; }
  • Import of the grepControlsTool for registration.
    import { grepControlsTool } from "./grep_controls_in_markdown.js";
  • Registration of grepControlsTool in the tools array passed to registerToolDefs.
    grepControlsTool,

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/ethanolivertroy/fedramp-docs-mcp'

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