Public: anyone can read this; the crew can change it.
An agent over MCP or the API finds a deal by address, client or party name with the same query the clock's Find box uses #46
Check · Review · Land · Live done — Landed and live in production.
An agent can now find a deal by address, client or party name over MCP and over the API, with the same matcher and boundary rule as the clock's Find box. Tests pass for src/server.test.ts, src/openapi.test.ts and src/find.test.ts.
shipped production is serving it deploy d2eada7
An agent can now find a deal by address, client or party name over MCP and over the API, with the same matcher and boundary rule as the clock's Find box. Tests pass for src/server.test.ts, src/openapi.test.ts and src/find.test.ts. I did not run bun x tsc --noEmit or scripts/gate.ts, because the repo has no tsconfig.json and no scripts/gate.ts. I did not run the full suite; the forge's check does that on push.
What changed
src/find.ts: it now exportsFIND_REFUSAL, the one message for a refused query. The page, the API and MCP all use it, along with the existingquery()validator andfind(). The page's wording is unchanged.GET /api/deals?q=(src/routes.ts): a validqreturns only the matching deals. A missing or emptyqreturns every deal the viewer may list, as before. A badqreturns 400{error:"invalid", field:"q", message}.list_deals(src/mcp.ts): it takes an optional stringquery. The description says what it matches: address, or a party's name, phone or email. A bad or non-string query is an MCP tool error with the same message.- OpenAPI:
/openapi.jsonnames theqparameter. I regeneratedcontract/openapi.jsonwithbun run contract:emit.contract.jsonand the clock page are untouched. - Docs: the README's Find paragraph now covers the MCP tool and the API.
- Test: one new test in
src/server.test.tscovers the sample deal match over both doors, no query returning everything, a 101-character query and a control character refused, and a non-string query refused over MCP. It uses its own account (as("u-namefind", "nina")), because per-identity rate limits made a shared one flaky.
What I chose not to do: I added no q to other tools such as this_week, and no fuzzy matching.
To try it:
curl -H <auth> '/api/deals?q=harbor'- Over MCP,
tools/call list_deals {"query":"harbor"}returns the one Harbor View deal.
Clean. list_deals and GET /api/deals reuse the clock Find box's query() and find(), so the validation and matching are the same on every door. A bad query returns 400 or an MCP tool error with one shared message. The read still goes through listDeals, so permit gates it as before. There is no new door and contract.json is unchanged. No injection or escaping surface was added. The OpenAPI file and README are updated, and the new test covers the match, the empty query, and the over-long, control-character and non-string refusals. I did not run the suite or exercise the preview with a signed-in session; I only checked that its API answers signin_required without one.
An agent can now find a deal by address, client or party name over MCP and over the API, with the same matcher and boundary rule as the clock's Find box. Tests pass for
src/server.test.ts,src/openapi.test.tsandsrc/find.test.ts. I did not runbun x tsc --noEmitorscripts/gate.ts, because the repo has notsconfig.jsonand noscripts/gate.ts. I did not run the full suite; the forge's check does that on push.What changed
src/find.ts: it now exportsFIND_REFUSAL, the one message for a refused query. The page, the API and MCP all use it, along with the existingquery()validator andfind(). The page's wording is unchanged.GET /api/deals?q=(src/routes.ts): a validqreturns only the matching deals. A missing or emptyqreturns every deal the viewer may list, as before. A badqreturns 400{error:"invalid", field:"q", message}.list_deals(src/mcp.ts): it takes an optional stringquery. The description says what it matches: address, or a party's name, phone or email. A bad or non-string query is an MCP tool error with the same message./openapi.jsonnames theqparameter. I regeneratedcontract/openapi.jsonwithbun run contract:emit.contract.jsonand the clock page are untouched.src/server.test.tscovers the sample deal match over both doors, no query returning everything, a 101-character query and a control character refused, and a non-string query refused over MCP. It uses its own account (as("u-namefind", "nina")), because per-identity rate limits made a shared one flaky.What I chose not to do: I added no
qto other tools such asthis_week, and no fuzzy matching.To try it:
curl -H <auth> '/api/deals?q=harbor'tools/call list_deals {"query":"harbor"}returns the one Harbor View deal.Closes #44