Skip to content

feat(codeflows): defineTool Zod→OpenAPI custom tools primitive - #6

Draft
DumbMachine wants to merge 8 commits into
codeflows-mvpfrom
cursor/custom-tools-e9bb
Draft

feat(codeflows): defineTool Zod→OpenAPI custom tools primitive#6
DumbMachine wants to merge 8 commits into
codeflows-mvpfrom
cursor/custom-tools-e9bb

Conversation

@DumbMachine

@DumbMachine DumbMachine commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

Custom tools are authored with @access/tools defineTool where Zod is the authoring primitive and OpenAPI is the wire. Deploy persists parameters + a mini OpenAPI 3 doc; MCP reuses the same discover / describe / execute surface agents already use for rest_api.

Authoring

import { defineTool, z } from "@access/tools";

export default defineTool({
  name: "twitter-search",
  description: "Search tweets",
  input: z.object({
    query: z.string().describe("Search query"),
  }),
  async invoke(input) { /* ... */ },
});

Agent / MCP contract

  • discover(kind="tool") — lists deployed tools
  • describe(kind="integration", slug="tool") — argv grammar
  • describe(kind="resource", slug="<tool>") — OpenAPI ops (invoke)
  • describe(..., query="invoke") — Zod→OpenAPI input_schema
  • execute({ resource, argv: ["http","invoke"], stdin }) — same shape as rest_api
  • Workflows: client.tool("name").invoke(input)

Implementation

  • New sdk/tools (defineTool + Zod 4 toJSONSchema target openapi-3.0)
  • Embedded runtime for esbuild (@access/tools virtual module)
  • Deploy probes defineTool metadata; legacy export const tool still upgrades to OpenAPI
  • MCP tools_custom.go + ToolBroker wired into mcpServer()
  • Tool detail UI shows Parameters + OpenAPI
  • Example tools migrated to defineTool

UI (prior)

  • Resources Integrations|Tools segment; full-bleed tool detail Chrome

Screenshots

Tools list

Tools list

Tool detail

Tool detail

Tool source

Tool source

Workflow using tools

Workflow activity

Test plan

  • go test ./core/codeflows/ ./core/mcpserver/
  • defineTool deploy + invoke + workflow test (multi-instance)
  • Legacy static export const tool still deploys
  • Unsupported tool capability fails explicitly
  • Re-bootstrap demo + refresh screenshots with OpenAPI panel

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

cursoragent and others added 8 commits August 5, 2026 13:43
Custom tools are portable TypeScript modules deployed like workflows and
invoked from workflows via client.tool(name).invoke(input). They appear on
the Resources Tools tab with describe APIs for agent DX, and are executed
through the same brokered operation path without worker credentials.

Co-authored-by: Ratin Kumar <ratin.kumar.2k@gmail.com>
Ship example Twitter tools + company-research workflow, with bootstrap and
screenshot scripts so the full tools→workflow→run UX can be reproduced via
make custom-tools-demo.

Co-authored-by: Ratin Kumar <ratin.kumar.2k@gmail.com>
Co-authored-by: Ratin Kumar <ratin.kumar.2k@gmail.com>
Merge latest codeflows-mvp design and restyle Tools inventory + Tool
detail to match DataTable / ChromeTab / flat MetaCell patterns.

Co-authored-by: Ratin Kumar <ratin.kumar.2k@gmail.com>
Resources Integrations/Tools use ChromeTabList; tools inventory rows
mirror workflows (entry subtitle, project, retire menu); tool detail
uses workflow-style meta band, flat copy block, and FileRenderer source.

Co-authored-by: Ratin Kumar <ratin.kumar.2k@gmail.com>
ChromeTabList belongs on detail pages. Integrations/Tools now use the
same FilterBar segment switch as Agents Mine/Shared so list chrome
matches codeflows-mvp.

Co-authored-by: Ratin Kumar <ratin.kumar.2k@gmail.com>
Drop mx-auto/max-w-5xl so Overview and Source use the full content
width like workflow Activity/Files.

Co-authored-by: Ratin Kumar <ratin.kumar.2k@gmail.com>
Author tools with @access/tools defineTool; deploy persists OpenAPI and
parameters so MCP discover/describe/execute reuse the same rest_api-shaped
operation surface for agents and workflows.

Co-authored-by: Ratin Kumar <ratin.kumar.2k@gmail.com>
@cursor cursor Bot changed the title feat(codeflows): agent-authored custom tools feat(codeflows): defineTool Zod→OpenAPI custom tools primitive Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants