πŸ“„ File detail

tools/FileWriteTool/prompt.ts

🧩 .tsπŸ“ 19 linesπŸ’Ύ 969 bytesπŸ“ text
← Back to All Files

🎯 Use case

This module implements the β€œFileWriteTool” tool (File Write) β€” something the model can call at runtime alongside other agent tools. On the API surface it exposes FILE_WRITE_TOOL_NAME, DESCRIPTION, and getWriteToolDescription β€” mainly types, interfaces, or factory objects. It composes internal code from FileReadTool (relative imports).

Generated from folder role, exports, dependency roots, and inline comments β€” not hand-reviewed for every path.

🧠 Inline summary

import { FILE_READ_TOOL_NAME } from '../FileReadTool/prompt.js' export const FILE_WRITE_TOOL_NAME = 'Write' export const DESCRIPTION = 'Write a file to the local filesystem.'

πŸ“€ Exports (heuristic)

  • FILE_WRITE_TOOL_NAME
  • DESCRIPTION
  • getWriteToolDescription

πŸ–₯️ Source preview

import { FILE_READ_TOOL_NAME } from '../FileReadTool/prompt.js'

export const FILE_WRITE_TOOL_NAME = 'Write'
export const DESCRIPTION = 'Write a file to the local filesystem.'

function getPreReadInstruction(): string {
  return `\n- If this is an existing file, you MUST use the ${FILE_READ_TOOL_NAME} tool first to read the file's contents. This tool will fail if you did not read the file first.`
}

export function getWriteToolDescription(): string {
  return `Writes a file to the local filesystem.

Usage:
- This tool will overwrite the existing file if there is one at the provided path.${getPreReadInstruction()}
- Prefer the Edit tool for modifying existing files \u2014 it only sends the diff. Only use this tool to create new files or for complete rewrites.
- NEVER create documentation files (*.md) or README files unless explicitly requested by the User.
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`
}