Skip to content

Search and describe app APIs by method - #297

Merged
tnkuehne merged 3 commits into
feat/service-documentation-storagefrom
feat/method-describe
Nov 22, 2026
Merged

tnkuehne merged 3 commits into
feat/service-documentation-storagefrom
feat/method-describe

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Why

With #290 an app can publish documentation for large APIs (hundreds of methods, thousands of types). MCP describe and widefleet services describe still returned an entrypoint's whole document with every type, which floods an agent's context before it calls anything.

What changes

MCP

  • search returns methods: hostname, entrypoint, method and the first line of its summary, best matches first. hostname and entrypoint filters narrow a query or, without words, list every method of a service. They replace the former "exact hostname as query" rule.
  • describe takes methods (1–20) and returns the entrypoint's documentation with only those methods, plus the types their signatures use, directly or through other types.
  • The service index stores one entry per method (format 2). Indexes of the earlier format are rebuilt like expired ones. Entrypoints without documented methods are not listed, since call only reaches methods.

API and CLI

  • GET /app-services/{service} returns documented, the list of methods with summaries, and documentation: null. With entrypoint and methods (comma-separated), documentation holds the selected methods and their types.
  • widefleet services describe APP [--entrypoint NAME] [--method NAME]…
  • The API reference page in the control plane keeps the complete documentation (connections.reference).

Selecting methods and their types is shared contract logic (selectServiceMethods, listServiceMethods), used by the runtime and the control plane.

Verification

  • pnpm check
  • pnpm exec vitest run (all suites)
  • RUN_SERVICE_TESTS=1 pnpm exec vitest run apps/control-plane/tests/app-services-runtime.test.ts (workerd and celld)
  • RUN_CLOUDFLARE_TESTS=1 pnpm exec vitest run apps/control-plane/tests/cloudflare
  • RUN_CLI_TESTS=1 pnpm exec vitest run apps/control-plane/tests/app-services-cli.test.ts apps/control-plane/tests/service-documentation.test.ts with a freshly built CLI
  • pnpm exec playwright test tests/e2e/auth.spec.ts
  • bash tools/cargo.sh clippy -p platform-cli --all-targets -- -D warnings, fmt --all --check

Documentation: #298 (draft until a release includes #290 and this PR).

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with the documentation updates supplied by PR #298.

Summary

Changes API discovery from whole services to individual methods.

  • MCP search returns matching app methods.
  • MCP describe returns documentation for selected methods.
  • The API and CLI list methods and describe selected ones.

No new actionable issues were found. Tests were inspected, not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Published API documentation] --> B[Method index]
  B --> C[MCP search]
  A --> D[selectServiceMethods]
  D --> E[MCP describe]
  D --> F[HTTP and CLI selected descriptions]
  A --> G[Complete reference page]
Loading

Reviews (4) · Last reviewed commit: "Match type names only as whole names" · Reviewed by Greptile

Comment thread crates/platform-cli/src/services.rs Resolved
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 1701c54 Nov 22 2026, 03:22 PM

@tnkuehne
tnkuehne force-pushed the feat/method-describe branch from 818323d to 5b92326 Compare November 22, 2026 15:02
An agent reading a large API through MCP received one entrypoint's whole
documentation and every type at once. Search now returns methods, with their
hostname, entrypoint and the first line of their summary, and can list every
method of one service. Describe takes the methods to read and returns their
signatures, the entrypoint's own documentation and only the types those
signatures use, directly or through other types. The service index stores one
entry per method and rebuilds indexes of the earlier format.

The management API and `widefleet services describe` list an API's methods and
describe selected ones with `--entrypoint` and `--method`. The API reference page
keeps showing the complete documentation.
The extractor names types as complete type expressions such as `Page<Item>`,
`One.Item` or `import("./model").Item`. Describing a method split these names
into identifiers and missed their definitions. Types are now looked up under
their first identifier and used when a signature contains the whole name.
A type name inside a longer name, such as `One.Item` in `One.ItemDetails` or
`Item` in `Two.Item`, no longer counts as a use, and a definition's declaration
of its own short name does not pull in an unrelated type of that name.
@tnkuehne
tnkuehne force-pushed the feat/method-describe branch from 245ed2b to 1701c54 Compare November 22, 2026 15:21
@tnkuehne
tnkuehne removed this pull request from stack #299 November 22, 2026 16:03
@tnkuehne
tnkuehne added this pull request to stack #304 November 22, 2026 16:03
@tnkuehne
tnkuehne merged commit a87f56c into main Nov 22, 2026
17 checks passed
@tnkuehne
tnkuehne deleted the feat/method-describe branch November 22, 2026 16:57
tnkuehne added a commit that referenced this pull request Nov 22, 2026
## Why

#297 finds the types a described method needs by searching its signature
texts for documented type names. Generated names take several forms
(`Item`, `One.Item`, `Page<Item>`, `import("./model").Item`), and review
already found two matching gaps. The extractor resolves every type it
documents, so it can state the references exactly instead.

## What changes

- **Extractor:** every signature and every type definition gets `uses`,
the names of the documented types it uses directly. Undocumented types
in between (unions, arrays, library generics such as `Promise` or `Map`)
pass their uses through.
- **Contract:** documentation format 2 with `uses` (defaults to an empty
list). Documentation of format 1 counts as missing in the runtime and
the control plane until the app is deployed again.
- **Selection:** `selectServiceMethods` follows `uses` from the selected
signatures through the type definitions. The text matching is removed.

## Verification

- `pnpm check`
- `pnpm exec vitest run` (all suites)
- `RUN_CLI_TESTS=1` CLI, network CLI, app-services CLI and documentation
extraction tests with a freshly built CLI; the extraction tests for
generic and namespaced types assert the selected types
- `RUN_WASM_TESTS=1 pnpm exec vitest run packages/service-docs` with the
rebuilt WebAssembly module
- `RUN_SERVICE_TESTS=1` runtime service tests (workerd and celld),
`RUN_CLOUDFLARE_TESTS=1` Cloudflare suite, `playwright test
tests/e2e/auth.spec.ts`
- `bash tools/cargo.sh test` and `clippy --all-targets -D warnings` for
`platform-service-docs`, `platform-service-docs-wasm` and
`platform-cli`; `fmt --all --check`






<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=115810480&amp;sig=07cc1fbcf1be1888f1d71a349684cf717c4c1b8a79ff4610861e6d6c0e387fb3"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F303&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge, with both
earlier findings fixed and no new issues found.

<details open><summary><h3>Summary</h3></summary>

Records exact type references in documentation format 2 and follows
those references when selecting methods.
- API documentation records the types used by each signature and
definition.
- Selected API methods include types linked from their signatures.
- Older API documentation is treated as missing until the app is
redeployed.
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (3) · Last reviewed commit: ["Expect recorded type uses in
the app
bui..."](e24ceb2)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
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.

1 participant