fix(core): sanitize registered tool names (#34512)

This commit is contained in:
Aiden Cline
2026-06-29 18:30:40 -05:00
committed by GitHub
parent ecfa918760
commit f928b5be07
4 changed files with 9 additions and 11 deletions
+3 -6
View File
@@ -70,17 +70,14 @@ describe("ApplicationTools", () => {
}),
)
it.effect("exposes narrow scoped Location registration and validates names", () =>
it.effect("exposes narrow scoped Location registration and sanitizes names", () =>
Effect.gen(function* () {
const tools: Tools.Interface = yield* Tools.Service
const registry = yield* ToolRegistry.Service
const scope = yield* Scope.make()
yield* tools.register({ location_tool: contextual([]) }).pipe(Scope.provide(scope))
expect((yield* toolDefinitions(registry)).map((tool) => tool.name)).toEqual(["location_tool"])
expect(yield* Effect.flip(tools.register({ "invalid name": contextual([]) }))).toBeInstanceOf(
Tool.RegistrationError,
)
yield* tools.register({ "location.tool/search": contextual([]) }).pipe(Scope.provide(scope))
expect((yield* toolDefinitions(registry)).map((tool) => tool.name)).toEqual(["location_tool_search"])
yield* Scope.close(scope, Exit.void)
expect(yield* toolDefinitions(registry)).toEqual([])