Skip to content

feat(kap-server): expose per-tool active state in GET /api/v1/tools - #2005

Merged
7Sageer merged 2 commits into
mainfrom
feat/kap-server-tools-active
Jul 21, 2026
Merged

feat(kap-server): expose per-tool active state in GET /api/v1/tools#2005
7Sageer merged 2 commits into
mainfrom
feat/kap-server-tools-active

Conversation

@7Sageer

@7Sageer 7Sageer commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No tracking issue — follow-up to #1735.

Problem

#1735 introduced three tool gates (profile tools/disallowedTools, the global [tools] config, and the session disabled_tools denylist) and let clients write the session denylist on prompt submission — but gave them no public way to read back the effective result. A client that sets disabled_tools cannot discover valid tool names or confirm which tools ended up active; the only gate-aware listing lived on the dev-only /api/v1/debug dispatcher.

What changed

GET /api/v1/tools now reports an active flag per tool — the effective availability under the composed tool policy (bound profile ∩ global [tools] config ∩ session denylist), computed with the same IAgentToolPolicyService.isToolActive the engine RPC getTools uses, so both surfaces agree.

  • ToolDescriptor.active is optional in both the kap-server-local and the shared @moonshot-ai/protocol schema: additive wire change, so old clients and the legacy v1 projection (no gate concept) are unaffected.
  • The route resolves the policy service from the same agent scope it already resolves the registry from — no new endpoints, and no behavior change when no gates are configured (active: true).
  • Tests: default active: true on the existing projection case; a new case asserting a session-denied tool wires out as active: false while others stay true; schema round-trip in @moonshot-ai/protocol.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2aeeb07

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@moonshot-ai/kap-server Patch
@moonshot-ai/protocol Patch
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 21, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@2aeeb07
npx https://pkg.pr.new/@moonshot-ai/kimi-code@2aeeb07

commit: 2aeeb07

Signed-off-by: 7Sageer <7sageer@djwcb.cn>
@7Sageer
7Sageer merged commit a3699dd into main Jul 21, 2026
23 of 24 checks passed
@7Sageer
7Sageer deleted the feat/kap-server-tools-active branch July 21, 2026 11:23
@github-actions github-actions Bot mentioned this pull request Jul 21, 2026
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