MCPcopy Index your code
hub / github.com/github/copilot-sdk / registerTools

Method registerTools

nodejs/src/session.ts:770–781  ·  view source on GitHub ↗

* Registers custom tool handlers for this session. * * Tools with handlers allow the assistant to execute custom functions automatically. * Declaration-only tools are surfaced as events and left pending for the consumer. * * @param tools - An array of tool definitions with t

(tools?: Tool[])

Source from the content-addressed store, hash-verified

768 * @internal This method is typically called internally when creating a session with tools.
769 */
770 registerTools(tools?: Tool[]): void {
771 this.toolHandlers.clear();
772 if (!tools) {
773 return;
774 }
775
776 for (const tool of tools) {
777 if (tool.handler) {
778 this.toolHandlers.set(tool.name, tool.handler);
779 }
780 }
781 }
782
783 /**
784 * Retrieves a registered tool handler by name.

Callers 2

initializeSessionMethod · 0.95
resumeSessionMethod · 0.95

Calls 2

clearMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected