Add MCP tools for log inspection and Script API/XSD docs#420
Draft
clavery wants to merge 2 commits into
Draft
Conversation
- Logs: logs_list_files, logs_get_recent, plus a watch lifecycle (logs_watch_start/poll/stop/list) that buffers entries between polls via a new LogWatchRegistry on ServerContext, so agents don't miss entries produced between request/response turns. - Docs: docs_search/read/list and docs_schema_search/read/list over the bundled Script API and XSD corpora; no instance auth required. - Adds a new DIAGNOSTICS toolset that groups the script debugger and log tools; existing debug-* tools also re-tagged. - Promotes log filter helpers (parseSinceTime, filterBy*, matchesLevel, matchesSearch) from the CLI to @salesforce/b2c-tooling-sdk so the MCP package can reuse them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
logs_list_files,logs_get_recent, plus a watch lifecycle (logs_watch_start/logs_watch_poll/logs_watch_stop/logs_watch_list) that buffers entries between polls so an agent doesn't miss logs produced between tool calls.docs_search,docs_read,docs_list,docs_schema_search,docs_schema_read,docs_schema_list. No instance auth required.DIAGNOSTICStoolset that groups the script debugger and log tools. Existing debug tools are re-tagged ontoDIAGNOSTICSin addition to their currentCARTRIDGES/SCAPIassignments.parseSinceTime,filterBy*,matchesLevel,matchesSearch) moved frompackages/b2c-cli/src/utils/logsinto@salesforce/b2c-tooling-sdk/operations/logsso the MCP package can reuse them. CLI re-exports from the SDK; existing CLI tests and behavior unchanged.LogWatchRegistryonServerContext(mirrorsDebugSessionRegistry): UUID watch ids, hostname-level dedup, capped buffer with eviction counter, idle TTL cleanup, poll waiters with timeout. New docs pages for both tool families and sidebar updates.Tool reference
Logs (CARTRIDGES, DIAGNOSTICS, SCAPI)
logs_list_filesprefixes?,sort_by?,sort_order?logs_get_recentprefixes?,count?,since?,level?,search?logs_watch_startprefixes?,last_entries?,poll_interval_ms?,level?,search?watch_idlogs_watch_pollwatch_id,timeout_ms?,max_entries?timeout_msif emptylogs_watch_stopwatch_idlogs_watch_listDocs (all toolsets)
docs_search/docs_read/docs_listfor Script API;docs_schema_search/docs_schema_read/docs_schema_listfor XSD.Test plan
pnpm run typecheck:agentpnpm run lint:agentpnpm --filter @salesforce/b2c-tooling-sdk run test:agent(1722 passing — verifies log filter helper promotion didn't break SDK or CLI usage)pnpm --filter @salesforce/b2c-cli run test:agent(1218 passing — verifies CLI still consumes filter helpers via SDK re-export)pnpm --filter @salesforce/b2c-dx-mcp run test:agent(767 passing — includes newlog-watch-registry.test.ts,logs-tools.test.ts,docs-tools.test.ts)logs_list_filesreturns fileslogs_get_recent {prefixes: ["error"], count: 5}returns parsed entrieslogs_watch_start→ trigger storefront error →logs_watch_pollreturns the entry →logs_watch_stopcleans updocs_search ProductMgr→docs_read dw.catalog.ProductMgr→ markdown bodydocs_schema_list→docs_schema_read catalog→ XSD contentpnpm run docs:dev— sidebar shows Logs under Diagnostics + new Documentation group; both new pages render