add-tool
Skill14 starsChanged 8 months agoMITView on GitHub
Add a new tool to PilotSwarm. Covers defining the tool with defineTool(), registering it on the worker (worker-level or per-session), referencing it from the client via toolNames, and adding an integration test.
We split this skill into the rules it gives an agent
3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 18 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Per-session: Call worker.setSessionConfig(sessionId, { tools: [myTool] }) after creating the session.
- Very specific: line 23
Create a test function following the existing pattern (e.g., testToolCalling).
- Very specific: line 26
Add the test to the tests array at the bottom.
“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add a New Tool
Tools are defined using defineTool() from @github/copilot-sdk and registered on the worker.
Steps
- Define the tool using
defineTool(name, { description, parameters, handler }).namemust be a unique string identifier (snake_case).descriptionshould clearly explain when the LLM should use it.parametersuses JSON Schema format withtype: "object",properties, andrequired.handleris an async function that receives the validated arguments and returns a result.
- Register on the worker — two patterns:
- Worker-level (recommended): Call
worker.registerTools([myTool])before or afterworker.start(). Clients reference it viatoolNames: ["my_tool"]. - Per-session: Call
worker.setSessionConfig(sessionId, { tools: [myTool] })after creating the session. Only works in same-process mode.
- Worker-level (recommended): Call
- Add a test in
test/sdk.test.js:- Create a test function following the existing pattern (e.g.,
testToolCalling). - Track whether the tool handler was called with a boolean flag.
- Assert the LLM's response reflects the tool's output.
- Add the test to the
testsarray at the bottom.
- Create a test function following the existing pattern (e.g.,
Example
import { defineTool } from "pilotswarm";
const myTool = defineTool("lookup_price", {
description: "Look up the current price of a product by name",
parameters: {
type: "object",
properties: {
product: { type: "string", description: "Product name" },
},
required: ["product"],
},
handler: async ({ product }) => {
const price = await fetchPrice(product);
return { product, price };
},
});
// Worker-level registration
worker.registerTools([myTool]);
// Client references by name
const session = await client.createSession({
toolNames: ["lookup_price"],
systemMessage: "You can look up product prices.",
});How tools flow to the Copilot SDK
worker.registerTools() → Map<string, Tool>
↓
SessionManager.getOrCreate() resolves toolNames → Tool[]
↓
ManagedSession.runTurn() merges user tools + system tools (wait, ask_user)
↓
copilotSession.registerTools(allTools) ← Copilot SDK method
↓
copilotSession.send({ prompt }) ← LLM sees registered toolsKey files
- src/managed-session.ts — where tools are merged and registered on
CopilotSession - src/session-manager.ts — where
toolNamesare resolved from the worker registry - src/worker.ts — where
registerTools()stores tools in the registry - test/sdk.test.js — integration tests
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- takeshy/obsidian-gemini-helper★ 118same name
- hhopke/intervals-icu-mcp★ 114same name
- Azure-Samples/art-voice-agent-accelerator★ 74same name
- takeshy/obsidian-llm-hub★ 38same name
- ooloth/dotfiles★ 24same name
- Cognigy/cognigy-plugin★ 18same name
- PinMeTo/pinmeto-location-mcp★ 15same name
- alunduil/alunduil-chezmoi★ 2same name
- eborden/logseq-mcp-server★ 2same name
- Adham-Aly/implement-loop★ 1same name
9 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository50 other files it gives its agents.
- packages/sdk/examples/repo-workspaces/seed/home/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-repair-loopSkill
- duroxide-orchestration-versioningSkill
- editorial-standardsSkill
- finance-research-standardsSkill
- valuation-methodsSkill
- pilotswarm-architectureSkill
- deployment-safetySkill
- incident-responseSkill
- add-activitySkill
- add-eventSkill
- add-testSkill
- agent-versioningSkill
- azure-ps-test-runner-vmSkill
- debug-orchestrationSkill
- debug-testSkill
- horizondb-idiosyncrasiesSkill
- horizon-facts-eval-sweepSkill
- investigate-duroxide-runtimeSkill
- pilotswarm-aks-deploySkill
- pilotswarm-aks-resetSkill
- pilotswarm-new-env-deploySkill
- pilotswarm-perfSkill
- pilotswarm-portal-app-regSkill
- pilotswarm-portal-auth-assignmentsSkill
- pilotswarm-releaseSkill
- pilotswarm-tuiSkill
- pilotswarm-vpn-client-profileSkill
- schema-migrationSkill
- notesSkill
- share-a-fileSkill
- cost-latency-analysisSkill
- graph-debugSkill
- orchestration-session-lifecycleSkill
- resourcemgrSkill
- sweeperSkill
- canvas-appsSkill
- html-visualsSkill
- pilotswarm-agent-versioningSkill
- pilotswarm-aks-identitySkill
- pilotswarm-azure-deployerSkill
- pilotswarm-azure-lessonsSkill
- pilotswarm-cli-builderSkill
- pilotswarm-duroxide-versioningSkill
- pilotswarm-hybrid-datastoreSkill
- pilotswarm-knowledge-harvesterSkill
- pilotswarm-portal-builderSkill
- pilotswarm-sdk-builderSkill
- pilotswarm-three-tierSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

