Repository navigation
feat(cli,tui): skills catalog budget flags (--skill-catalog-max-skills/--skill-catalog-max-bytes) #2587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat(cli,tui): skills catalog budget flags (--skill-catalog-max-skills/--skill-catalog-max-bytes) #2587
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e5c2124
feat(cli,tui): --skill-catalog-max-skills/--skill-catalog-max-bytes f…
cliffhall 58a58a9
fix(core): name the decimal-digit and safe-integer limits in the budg…
cliffhall 93cf3ed
docs(tui): say the skills budget flags do not bound the one-skill Ski…
cliffhall 783e3e9
test(tui): cover runTui forwarding of --skill-catalog-max-* to the lo…
cliffhall f8b51d0
fix(cli): require --verify for --skill-catalog-max-* (#2420)
cliffhall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import { describe, it, expect, vi } from "vitest"; | ||
| import type { ServerLoadOptions } from "@inspector/core/mcp/node/servers.js"; | ||
|
|
||
| /** | ||
| * `runTui`'s Commander registration and the forwarding of parsed flags into | ||
| * the shared server loader (#2420). `tui.tsx` sits outside the TUI coverage | ||
| * `include` (`src/**`), and `tui-servers.test.ts` calls the loader directly, | ||
| * so without this a misspelt option or a dropped forwarding field would pass | ||
| * every other test. | ||
| * | ||
| * The loader is mocked to throw a sentinel carrying the options it received, | ||
| * which stops `runTui` before it touches stdout or renders Ink. | ||
| */ | ||
| class Captured extends Error { | ||
| constructor(readonly options: ServerLoadOptions) { | ||
| super("captured"); | ||
| } | ||
| } | ||
|
|
||
| vi.mock("../src/tui-servers.js", () => ({ | ||
| loadTuiServers: (options: ServerLoadOptions) => { | ||
| throw new Captured(options); | ||
| }, | ||
| })); | ||
|
|
||
| async function loaderOptionsFor(argv: string[]): Promise<ServerLoadOptions> { | ||
| const { runTui } = await import("../tui.js"); | ||
| try { | ||
| await runTui(["node", "mcp-inspector-tui", ...argv]); | ||
| } catch (err) { | ||
| if (err instanceof Captured) return err.options; | ||
| throw err; | ||
| } | ||
| throw new Error("runTui returned without calling the server loader"); | ||
| } | ||
|
|
||
| describe("runTui --skill-catalog-max-* forwarding (#2420)", () => { | ||
| it("forwards both budget flags, parsed as numbers, to the server loader", async () => { | ||
| const options = await loaderOptionsFor([ | ||
| "--server-url", | ||
| "http://127.0.0.1:1/mcp", | ||
| "--transport", | ||
| "http", | ||
| "--skill-catalog-max-skills", | ||
| "3", | ||
| "--skill-catalog-max-bytes", | ||
| "4096", | ||
| ]); | ||
| expect(options.skillCatalogMaxSkills).toBe(3); | ||
| expect(options.skillCatalogMaxBytes).toBe(4096); | ||
| }); | ||
|
|
||
| it("leaves both unset when the flags are absent", async () => { | ||
| const options = await loaderOptionsFor([ | ||
| "--server-url", | ||
| "http://127.0.0.1:1/mcp", | ||
| "--transport", | ||
| "http", | ||
| ]); | ||
| expect(options.skillCatalogMaxSkills).toBeUndefined(); | ||
| expect(options.skillCatalogMaxBytes).toBeUndefined(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declined.
--method skills/get --verifyis a valid--verifyrun, and the budget there behaves exactly as the samemcp.jsonsetting does: it is read and applied, it just cannot truncate a one-entry run. The--verifypairing exists to reject a flag on a run where no budget is ever read. Narrowing further, toskills/listonly, is extra hardening beyond #2420, so I am leaving it out of this PR.