Repository navigation
[EPIC-D][LOU-D24] Built-in tools are defined with defineTool; no ai.tool() in http, slack, email, date, delegation and MCP loader - #108
Merged
Conversation
…ool() in http, slack, email, date, delegation and MCP loader currentDate, dayName, email, http, slack and DelegationTool use defineTool; McpToolLoader uses the new toolDescriptorFromSchema() (no name/description validation, as server-provided). routeFetchThroughSandbox reads the canonical execute. The ops-pipeline fixer wrapper overrides the canonical execute. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
currentDateTool,dayNameTool,createEmailTool(),createHttpTool(),createSlackTool()andcreateDelegateTool()are built withdefineTool(namescurrent_date,day_name,send_email,http_request,slack_alert,delegate_to_<sanitized agent name>). Descriptions, schemas, approval/sandbox behaviour and factory signatures are unchanged; none imports fromai.McpToolLoaderbuilds descriptors with the newtoolDescriptorFromSchema()helper insrc/tools/toolContract.ts(canonicalinputSchema/executeplus a hand-built legacy.tool). It is used instead ofdefineToolbecause MCP tool names and descriptions come from remote servers:defineToolrejects names outside[a-zA-Z0-9_-]{1,64}and empty descriptions, which would silently turn previously loadable tools into skipped ones.routeFetchThroughSandbox(sandboxFetch.ts, read path only) now reads the canonicalexecuteviagetToolExecute().src/tools/noAiToolImport.test.tsasserts none of the converted files (plus sandboxFetch.ts) import fromai; one new unit test fortoolDescriptorFromSchema.Why
Step 3 of the
aiv4 -> v6/v7 upgrade chain: D22 madeinputSchema/executecanonical, D23 ownsToolExecutionContext; the remaining small built-ins still calledai.tool().Hazards found and handled:
examples/ops-pipeline/fixer.ts(createFixerDelegateTool) spreadcreateDelegateTool()and replaced onlytool.execute. Now that the base descriptor has a canonicalexecute(which wins), the patch-extraction wrapper was bypassed andexamples/ops-pipelinetests failed. It now wraps the canonicalexecutetoo (and no longer importsai). This is a file outside the listed scope, forced by the conversion.github.ts/jira.ts(D25) build raw descriptors with no canonicalexecute, so they are unaffected by this change; left untouched.Remaining
from 'ai'imports under src/ (non-comment)src/types/tool.ts(type-onlyTool as AITool, legacy.tool, removed in D26)src/providers/OpenRouterProvider.ts,AnthropicProvider.ts,OpenAIProvider.ts,OllamaProvider.ts(LanguageModel)src/providers/aiSdkProvider.tssrc/tools/built-in/jira.ts,src/tools/built-in/github.ts(tool, D25)src/execution/structuredOutput.ts(zodSchema)src/execution/errors.ts(APICallError,LoadAPIKeyError,RetryError)src/tools/defineTool.test-d.ts, and tests that mock/importai(e.g.src/tools/toolContract.test.ts)src/execution/generateStep.tsonly mentions'ai'in a comment.)Acceptance criteria
defineTool(MCP loader viatoolDescriptorFromSchema()), names/descriptions/schemas/approval/sandbox/factory signatures kept, noaiimportsai-import test and atoolDescriptorFromSchematestfrom 'ai'imports listed aboveexamples/ops-pipeline/fixer.ts(see Why)How verified
npx tsc --noEmit: cleannpm run lint: 0 errors, 402 warnings (changed files: net -1anywarning in sandboxFetch.ts; none added)npm run test:types: no errorsnpx vitest run: all pass after the fixer fix (first run had 2 failures in examples/ops-pipeline, fixed here)npm run build && npm run build --workspace=packages/create-loushy-agent: successnpm run test:coverage: 158 files passed, 2289 tests passed, 3 skippednpm run fallow: dead code 0 issues, exit 0 (one pre-existing duplicate group in Anthropic/OpenAI providers, unrelated)🤖 Generated with Claude Code
https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR
Generated by Claude Code