Skip to content

Fix Outlook folder search paging and GoHighLevel contact page size - #1812

Closed
helpcodeai wants to merge 1 commit into
mainfrom
fix/outlook-skiptoken-ghl-pagelimit
Closed

helpcodeai wants to merge 1 commit into
mainfrom
fix/outlook-skiptoken-ghl-pagelimit

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

Two catalog adapter fixes, both found in production tool-call errors.

  • Outlook, outlook_list_messages: the tool maps both $search and $skip. Microsoft Graph refuses $skip together with $search (SearchWithSkip), so a model that pages a folder search the way the old skip description told it to fails every time. outlook_search_messages already solved this with a skip_token parameter; outlook_list_messages now does the same.
  • GoHighLevel, gohighlevel_search_contacts: when the caller leaves page_limit out, the body has no pageLimit, and HighLevel answers 422 pageLimit must be a number. The description already promised "default 20", but nothing sent it. page_limit now carries a JSON-Schema "default": 20.

Changes

  • intl/microsoft-outlook.json, outlook_list_messages: new optional skip_token string mapped to $skiptoken. The skip description now uses the same wording as outlook_search_messages ("Only with filter or no search: ... Outlook refuses skip together with search: use skip_token there."). The search descriptions of both tools now say "Page it with skip_token, not skip.", and the instructions' pagination paragraph names both tools.
  • intl/gohighlevel.json, gohighlevel_search_contacts: page_limit gets "default": 20.
  • Specs: intl/microsoft-outlook.live.spec.ts checks that a folder search pages with $skiptoken and never sends $skip. It also checks that every Outlook tool that maps both $search and $skip maps $skiptoken and says so in its descriptions. intl/gohighlevel.live.spec.ts runs gohighlevel_search_contacts through the real RestEngine (axios mocked), filling schema defaults with applySchemaDefaults the way DynamicMcpTools.executeTool does. It asserts the body is { locationId, query, pageLimit: 20 } when page_limit is omitted, and that a caller's own value wins.

Why a schema default works here

DynamicMcpTools.executeTool (mcp-server/dynamic-mcp-tools.ts) and the dashboard Run test (connectors/connectors.service.ts) both call applySchemaDefaults (common/schema-defaults.util.ts) before the REST engine builds the request. That function fills the default of every top-level parameter that is undefined. Without a value, the REST engine drops a $arg body key, which explains the old empty pageLimit. With the default, the key is filled before mapping. I ran the new spec with the default removed: it fails (body without pageLimit). With the default in place, it passes.

Other GoHighLevel tools checked

I compared every GoHighLevel parameter whose description mentions a default against the upstream OpenAPI (GoHighLevel/highlevel-api-docs, apps/*.json). None has the same bug: on every other endpoint, limit/offset are optional upstream and have a server default. The two endpoints where they are required (GET /invoices/ and the social posts list) already carry schema defaults. Not changed here, but worth noting: the descriptions of gohighlevel_list_orders, gohighlevel_list_transactions and gohighlevel_list_subscriptions say "(default 20)", while the upstream default for limit is 10. That is a wording mismatch, not a failing call.

Effect on installed connectors (Cloud and self-hosted alike)

Both changes are safe-class for the catalog re-sync (connectors/catalog-resync.service.ts):

  • GoHighLevel: only parameters changed, so the change is safe.
  • Outlook: the endpointMapping only gains one query key, $skiptoken: "$skip_token", a plain $arg whose parameter is optional and has no default. additiveQueryParams classifies that as safe: a call without skip_token sends exactly the request it sent before. The description, parameter and instruction changes are safe as well.

CatalogReconciler applies the safe class automatically at boot to every catalog-installed connector, on Cloud and self-hosted alike, unless a self-hoster set CATALOG_AUTOSYNC=false. In that case "Apply update" on the connector applies it. The adapter version is content-addressed at runtime (computeAdapterVersion), so catalog.ts needed no change (regenerate-catalog.mjs produced no diff).

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactoring
  • Performance improvement
  • Other (describe below)

Testing

  • Added/updated unit tests
  • Tested manually (describe steps below)
  • No tests needed (explain why)

All commands below ran on this branch. Repository root: npm ci. In packages/backend: DATABASE_URL=postgresql://x:x@localhost:5433/x npx prisma generate.

Directory Command Result
root node scripts/validate-adapters.mjs --warn exit 0. The output is byte-identical to the same run with both adapters reset to main (1435 existing warnings; the two files add none). The Outlook tool-prefix warnings (outlook_ vs microsoft_outlook_) were already there.
root node scripts/regenerate-catalog.mjs 973 adapters across 21 regions, no diff in catalog.ts
root node scripts/adapter-count.mjs --check OK: every quoted count equals 957 adapters (51 keyless, 19991 tools).
packages/backend npx jest --maxWorkers=4 src/adapters/intl/microsoft-outlook.live.spec.ts src/adapters/intl/gohighlevel.live.spec.ts 2 suites passed; 36 tests passed, 5 skipped (live parts, gated by RUN_OUTLOOK_LIVE / RUN_GOHIGHLEVEL_LIVE)
packages/backend same GoHighLevel spec with "default": 20 removed 1 failed (the new test), as expected; default restored afterwards
packages/backend npx jest --maxWorkers=4 --silent 'src/adapters/[^/]+\.spec\.ts$' src/connectors/catalog- src/common/schema-defaults 36 suites passed, 24315 tests passed
packages/backend npx tsc --noEmit -p tsconfig.json no errors
packages/backend npx eslint src/adapters/intl/gohighlevel.live.spec.ts src/adapters/intl/microsoft-outlook.live.spec.ts no findings. I did not run the full npm run lint, because its --fix rewrites unrelated files.

I did not run the full backend npm test: about 940 adapter specs fall outside this change. The suites I ran are the catalog-wide specs plus the two adapters.

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable): the adapter instructions and parameter descriptions
  • All existing tests pass (npm test): only the targeted suites listed above were run
  • This PR has a descriptive title

Related Issues

None filed; found in production tool-call error logs.

outlook_list_messages mapped $skip next to $search, and Microsoft Graph
refuses the two together (SearchWithSkip). Add skip_token mapped to
$skiptoken, as outlook_search_messages already does, and say in the
skip and search descriptions that a search pages with skip_token.

gohighlevel_search_contacts sent no pageLimit when the caller left
page_limit out, and HighLevel answers 422 "pageLimit must be a number".
Give page_limit a JSON-Schema default of 20 (what its description
already promised); the tool call fills schema defaults before the REST
engine builds the body. The spec runs the engine path to prove it.
@helpcodeai

Copy link
Copy Markdown
Contributor Author

Folded into the v0.55.8 release PR #1813 (merged as 5777a92).

@helpcodeai helpcodeai closed this Nov 21, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant