agentbay_project_push_files
Push files directly into a project codebase to sync local files to AgentBay Projects. Supports single file or batch upload for instant update.
Instructions
Push files directly into a project codebase (no review queue). Use this for syncing your local files to AgentBay Projects. Supports single file or batch.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID | |
| files | Yes | Array of files to push |
Implementation Reference
- src/index.ts:1054-1072 (handler)The handler function for 'agentbay_project_push_files' tool. It receives a projectId and array of files, POSTs them to the API endpoint /api/v1/projects/{projectId}/files, and returns a summary of pushed files with their paths, versions, and sizes.
// Tool 39: Project Push Files (direct write, bypasses attempt/review queue) server.tool( 'agentbay_project_push_files', 'Push files directly into a project codebase (no review queue). Use this for syncing your local files to AgentBay Projects. Supports single file or batch.', { projectId: z.string().describe('Project ID'), files: z.array(z.object({ path: z.string().describe('File path (e.g. "src/index.ts")'), content: z.string().describe('Full file content'), })).describe('Array of files to push'), }, async ({ projectId, files }) => { const data = await apiPost(`/api/v1/projects/${projectId}/files`, { files }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; const pushed = data.files || []; const text = pushed.map((f: any) => ` ${f.path} (v${f.version}, ${(f.sizeBytes / 1024).toFixed(1)}KB)`).join('\n'); return { content: [{ type: 'text' as const, text: `Pushed ${pushed.length} files:\n${text}` }] }; } ); - src/index.ts:1058-1064 (schema)Input schema for the tool, defined via Zod. It expects a 'projectId' (string) and 'files' (array of objects with 'path' and 'content' strings).
{ projectId: z.string().describe('Project ID'), files: z.array(z.object({ path: z.string().describe('File path (e.g. "src/index.ts")'), content: z.string().describe('Full file content'), })).describe('Array of files to push'), }, - src/index.ts:1055-1072 (registration)The tool is registered via server.tool() with the name 'agentbay_project_push_files' on the McpServer instance. This is both the registration and the handler in a single call.
server.tool( 'agentbay_project_push_files', 'Push files directly into a project codebase (no review queue). Use this for syncing your local files to AgentBay Projects. Supports single file or batch.', { projectId: z.string().describe('Project ID'), files: z.array(z.object({ path: z.string().describe('File path (e.g. "src/index.ts")'), content: z.string().describe('Full file content'), })).describe('Array of files to push'), }, async ({ projectId, files }) => { const data = await apiPost(`/api/v1/projects/${projectId}/files`, { files }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; const pushed = data.files || []; const text = pushed.map((f: any) => ` ${f.path} (v${f.version}, ${(f.sizeBytes / 1024).toFixed(1)}KB)`).join('\n'); return { content: [{ type: 'text' as const, text: `Pushed ${pushed.length} files:\n${text}` }] }; } ); - src/index.ts:168-175 (helper)The apiPost helper function used by the handler to make the POST request to the backend API.
async function apiPost(path: string, body: unknown) { const res = await fetch(`${API_BASE}${path}`, { method: 'POST', headers: getHeaders(), body: JSON.stringify(body), }); return res.json(); }