Skip to content

Add get-code-ref-statistics MCP tool for Code References API#81

Open
akashanand708 wants to merge 1 commit into
launchdarkly:mainfrom
akashanand708:feat/get-code-ref-statistics
Open

Add get-code-ref-statistics MCP tool for Code References API#81
akashanand708 wants to merge 1 commit into
launchdarkly:mainfrom
akashanand708:feat/get-code-ref-statistics

Conversation

@akashanand708

@akashanand708 akashanand708 commented Jul 3, 2026

Copy link
Copy Markdown

Related issues

Link any issue tracking this feature (e.g., a ticket requesting Code References API support in the MCP server).

Describe the solution you've provided

Added a new get-code-ref-statistics MCP tool that exposes the LaunchDarkly Code References statistics API (GET /api/v2/code-refs/statistics/{projectKey}). The tool returns the number of repositories and code references for each feature flag in a project, with an optional flagKey filter to scope results to a single flag.

New files added:

  • src/funcs/codeReferencesGetStatistics.ts — core API call implementation
  • src/mcp-server/tools/codeReferencesGetStatistics.ts — MCP tool definition with description and scope
  • src/models/components/coderefstatisticsrep.ts — Zod schemas for StatisticRep and StatisticCollectionRep response types
  • src/models/operations/getcoderefstatistics.ts — request schema and serialization helpers

Modified:

  • src/mcp-server/server.ts — registered the new tool
  • src/models/components/index.ts and src/models/operations/index.ts — exported new types

Describe alternatives you've considered

No meaningful alternatives — this is a straightforward addition following the existing tool pattern already used by codeReferencesListRepositories and other tools in the server.

Additional context

The tool is particularly useful for flag cleanup workflows: before archiving or removing a flag, consumers can call this tool to verify the flag has zero remaining code references across all repositories.

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