Repository navigation
mcpx: mcpx-agy examples/ subdir + first-served-skill guard test (#268) #269
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
15 changes: 15 additions & 0 deletions
15
pkgs/mcpx/plugin/opencode/skills/mcpx-agy/examples/README.md
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,15 @@ | ||
| # Example scripts for Antigravity (AGY) | ||
|
|
||
| Each script is run from AGY's `run_command`, the way `SKILL.md` describes: | ||
| point `mcpx run` at a copy of the file, or copy one into | ||
| `.mcpx/scripts/` to run it by name. `mcpx run` writes the generated | ||
| client (`mcpx-client.ts`) beside the script it runs, so run a copy | ||
| rather than the file inside a checkout of mcpx. | ||
|
|
||
| | script | what it shows | try it | | ||
| | ------------------------ | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | | ||
| | `compact-call.ts` | calling one tool and printing only a bounded summary, so a large result does not bloat the AGY transcript | `mcpx run compact-call.ts codedb.status '{}'` | | ||
| | `chain-docs-and-code.ts` | chaining two servers in one script — library docs plus the local code index — and printing only the answer from each | `mcpx run chain-docs-and-code.ts react "useCallback dependencies"` | | ||
|
|
||
| Both exit 2 with a usage line when called without arguments, like the | ||
| `mcpx-basics` examples. |
29 changes: 29 additions & 0 deletions
29
pkgs/mcpx/plugin/opencode/skills/mcpx-agy/examples/chain-docs-and-code.ts
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,29 @@ | ||
| // Chain two servers in one script: library docs plus the local code index. | ||
| // | ||
| // mcpx run chain-docs-and-code.ts <libraryId> "<docs query>" | ||
| // | ||
| // This is the chaining pattern from SKILL.md section 2, kept in a single | ||
| // invocation so neither server's full result crosses into the AGY | ||
| // transcript: the script prints the indexed-file count and only the | ||
| // first documentation snippet. Promise.allSettled, so a server that is | ||
| // not configured reports its failure without hiding the other answer. | ||
| const [libraryId, query] = Deno.args; | ||
| if (!libraryId || !query) { | ||
| console.error('usage: mcpx run chain-docs-and-code.ts <libraryId> "<docs query>"'); | ||
| Deno.exit(2); | ||
| } | ||
| const [status, doc] = await Promise.allSettled([ | ||
| tools.codedb.status({}), | ||
| tools.context7.query_docs({ libraryId, query }), | ||
| ]); | ||
| if (status.status === "fulfilled") { | ||
| console.log("Indexed files:", (status.value as any)?.fileCount ?? "unknown"); | ||
| } else { | ||
| console.log("codedb status failed:", (status.reason as Error).message); | ||
| } | ||
| if (doc.status === "fulfilled") { | ||
| const results = (doc.value as any)?.results; | ||
| console.log(results?.[0]?.snippet ?? "Not found"); | ||
| } else { | ||
| console.log("context7 query failed:", (doc.reason as Error).message); | ||
| } | ||
19 changes: 19 additions & 0 deletions
19
pkgs/mcpx/plugin/opencode/skills/mcpx-agy/examples/compact-call.ts
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,19 @@ | ||
| // Call one tool from AGY and print only a bounded summary. | ||
| // | ||
| // mcpx run compact-call.ts <namespace>.<tool> '{"arg":"value"}' | ||
| // | ||
| // In Antigravity every byte a tool returns lands in transcript.jsonl, so | ||
| // the point of running through `mcpx exec` / `mcpx run` instead of a | ||
| // direct MCP call is that only what this script prints comes back. | ||
| // Measure the result first, then print a slice of it. | ||
| const [target, json = "{}"] = Deno.args; | ||
| const dot = target?.indexOf(".") ?? -1; | ||
| if (dot < 1) { | ||
| console.error("usage: mcpx run compact-call.ts <namespace>.<tool> [json-args]"); | ||
| Deno.exit(2); | ||
| } | ||
| const r = await call(target.slice(0, dot), target.slice(dot + 1), JSON.parse(json)); | ||
|
|
||
| const text = typeof r === "string" || r instanceof String ? String(r) : JSON.stringify(r); | ||
| console.log(`${text.length} chars`); | ||
| console.log(text.slice(0, 500)); |
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.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: developing-today/code
Length of output: 4833
🏁 Script executed:
Repository: developing-today/code
Length of output: 41475
🏁 Script executed:
Repository: developing-today/code
Length of output: 24766
🏁 Script executed:
Repository: developing-today/code
Length of output: 7967
Defer each tool call before passing it to
Promise.allSettled.When a server is not configured, the generated client does not emit its namespace. The fallback on
toolsreturns a function, sotools.codedb.statusortools.context7.query_docsis undefined and the direct call throws while the array is built.Promise.allSettledthen cannot report the other server's result.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents