From a60c02576f9a733d8f5a49762f79dd88e2b86b15 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Sun, 14 Dec 2025 13:43:51 +1000 Subject: [PATCH] docs: add execution API documentation to /docs page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Document POST /api/tools/execute/[...slug] endpoint - Show URL formats (by tool ID and by package/export name) - Document request body parameters (prompt, parameters) - List SSE events (chunk, tokens, complete, error) - Add curl and JavaScript code examples - Document rate limiting (10 requests/minute per IP) - Add to sidebar navigation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- apps/web/src/app/docs/page.tsx | 120 +++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/apps/web/src/app/docs/page.tsx b/apps/web/src/app/docs/page.tsx index e6f239b..80ecc2c 100644 --- a/apps/web/src/app/docs/page.tsx +++ b/apps/web/src/app/docs/page.tsx @@ -33,6 +33,7 @@ const NAV_SECTIONS = [ { id: 'api-tools', label: 'GET /api/tools' }, { id: 'api-tools-search', label: 'GET /api/tools/search' }, { id: 'api-tool-detail', label: 'GET /api/tools/[id]' }, + { id: 'api-execute', label: 'POST /api/tools/execute' }, ], }, { @@ -682,6 +683,125 @@ const result = streamText({ + +

+ Execute a tool with an AI agent and receive streaming results via Server-Sent Events + (SSE). This endpoint allows you to run any TPMJS tool remotely without installing + it. +

+ +
+

+ By tool ID:{' '} + /api/tools/execute/clx123abc +

+

+ By package and export:{' '} + + /api/tools/execute/@tpmjs/hello/helloWorldTool + +

+
+
+ + + + +
+
+ chunk +

+ Streaming text chunks from the AI agent response +

+
+
+ tokens +

+ Token usage updates during execution +

+
+
+ complete +

+ Final result with output, token breakdown, and execution time +

+
+
+ error +

+ Error message if execution fails +

+
+
+
+ + + + + + + + + The execute endpoint is rate limited to 10 requests per minute per IP address. + Rate limit headers are included in the response: + X-RateLimit-Limit: 10 + X-RateLimit-Remaining: 9 + + +
+ {/* ==================== PUBLISHING TOOLS ==================== */}