MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / registerCompilersTool

Function registerCompilersTool

lib/mcp/tools/compilers.ts:109–209  ·  view source on GitHub ↗
(server: McpServer, apiHandler: ApiHandler)

Source from the content-addressed store, hash-verified

107}
108
109export function registerCompilersTool(server: McpServer, apiHandler: ApiHandler): void {
110 server.tool(
111 'list_compilers',
112 'List available compilers, optionally filtered by language',
113 {
114 language: z.string().optional().describe('Language ID to filter by (e.g. "c++", "rust", "python")'),
115 instructionSet: z
116 .enum(InstructionSetsList)
117 .optional()
118 .describe(
119 'Target architecture filter. Combine with `latestPerMajor: true` for "newest X for arch Y" ' +
120 '(e.g. `{language:"c++", instructionSet:"amd64", latestPerMajor:true}`).',
121 ),
122 match: z
123 .string()
124 .optional()
125 .describe(
126 'Case-insensitive AND-of-tokens filter on id and name. Punctuation splits tokens; numeric ' +
127 'tokens match whole-word ("gcc 14.1" matches "14.1.0" not "14.10"); alphanumeric tokens ' +
128 'substring-match ("g14" matches "g142"). Literal text only — for "newest version" use ' +
129 '`latestPerMajor`; for "newest X on arch Y" prefer `instructionSet` + `latestPerMajor`.',
130 ),
131 maxResults: z
132 .number()
133 .int()
134 .positive()
135 .optional()
136 .describe(
137 `Cap full-detail entries (default ${DEFAULT_MAX_RESULTS}). Beyond the cap, degrades to lean ` +
138 '(id+name only) with a refinement hint.',
139 ),
140 lean: z
141 .boolean()
142 .optional()
143 .describe('Force id+name only, regardless of count. Useful to browse the catalog before drilling in.'),
144 latestPerMajor: z
145 .boolean()
146 .optional()
147 .describe(
148 `"Newest X" filter. By release track (${RELEASE_TRACKS.join('/')}): newest stable per ` +
149 '(language, instructionSet, semver major); all nightly + prerelease; experimental ' +
150 'skipped unless `includeExperimental: true`.',
151 ),
152 includeExperimental: z
153 .boolean()
154 .optional()
155 .describe(
156 'With `latestPerMajor: true`, also include experimental compilers (c++ proposal forks, ' +
157 'llvm-mos platform variants). Off by default — bloats "newest X" answers.',
158 ),
159 },
160 {
161 title: 'List compilers',
162 readOnlyHint: true,
163 openWorldHint: false,
164 },
165 async ({language, instructionSet, match, maxResults, lean, latestPerMajor, includeExperimental}) => {
166 let pool = apiHandler.compilers;

Callers 2

createMcpServerFunction · 0.85
mcp-tests.tsFile · 0.85

Calls 6

applyMatchFunction · 0.85
pickLatestFunction · 0.85
applyCapFunction · 0.85
stringMethod · 0.80
numberMethod · 0.80
booleanMethod · 0.80

Tested by

no test coverage detected