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

Method _register_tools

python/copilot/session.py:2378–2400  ·  view source on GitHub ↗

Register 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. Note: This method is internal. Tools are

(self, tools: list[Tool] | None)

Source from the content-addressed store, hash-verified

2376 self._capabilities: SessionCapabilities = capabilities if capabilities is not None else {}
2377
2378 def _register_tools(self, tools: list[Tool] | None) -> None:
2379 """
2380 Register custom tool handlers for this session.
2381
2382 Tools with handlers allow the assistant to execute custom functions automatically.
2383 Declaration-only tools are surfaced as events and left pending for the consumer.
2384
2385 Note:
2386 This method is internal. Tools are typically registered when creating
2387 a session via :meth:`CopilotClient.create_session`.
2388
2389 Args:
2390 tools: A list of Tool objects with their handlers, or None to clear
2391 all registered tools.
2392 """
2393 with self._tool_handlers_lock:
2394 self._tool_handlers.clear()
2395 if not tools:
2396 return
2397 for tool in tools:
2398 if not tool.name or not tool.handler:
2399 continue
2400 self._tool_handlers[tool.name] = tool.handler
2401
2402 def _get_tool_handler(self, name: str) -> ToolHandler | None:
2403 """

Callers 2

_initialize_sessionMethod · 0.95
resume_sessionMethod · 0.95

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected