Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/agent-core/src/agent/tool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ export class ToolManager {
for (const tool of tools) {
if (enabledTools !== undefined && !enabledTools.has(tool.name)) continue;
const qualified = qualifyMcpToolName(serverName, tool.name);
// Skip tools that are explicitly disabled via the profile's deny patterns
if (this.mcpDenyPatterns.some((pattern) => picomatch.isMatch(qualified, pattern))) {
continue;
}
Comment on lines +301 to +303

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve denied MCP tools for later profile changes

When a server connects while the current profile has an MCP deny pattern, this continue drops the tool from mcpTools entirely. Later useProfile()/setActiveTools() only updates the allow/deny pattern fields and re-filters the existing registry; it does not rediscover or re-register the server, so switching to a profile that allows mcp__server__tool cannot make that tool available again until the MCP server reconnects or the session restarts. Keeping registration complete and enforcing deny at exposure/dispatch time would preserve the existing runtime profile-toggle behavior.

Useful? React with 👍 / 👎.

const firstInThisCall = seenInThisCall.get(qualified);
if (firstInThisCall !== undefined) {
collisions.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Writing the prompt:
Usage notes:
- When the task continues earlier work a subagent already did, prefer resuming that agent (pass its `resume` id) over spawning a fresh instance — the resumed agent keeps its prior context.
- A subagent's result is only visible to you, not to the user. When the user needs to see what a subagent produced, summarize the relevant parts yourself in your own reply.
- Subagents use a fixed 30-minute timeout. If one times out, resume the same agent instead of starting over.
- Subagents use a fixed 2-hour timeout. If one times out, resume the same agent instead of starting over.

When NOT to use Agent: skip delegation for trivial work you can do directly — reading a file whose path you already know, searching a small known set of files, or any task that takes only a step or two. Delegation has a context-handoff cost; it pays off only when the task is substantial enough to outweigh it.

Expand Down
2 changes: 1 addition & 1 deletion packages/agent-core/test/tools/agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('AgentTool', () => {
const host = mockSubagentHost({ spawn: vi.fn() });
const tool = agentTool(host);

expect(tool.description).toContain('fixed 30-minute timeout');
expect(tool.description).toContain('fixed 2-hour timeout');
expect(tool.description).not.toContain('operator-configured background timeout');
expect(tool.description).not.toContain('no time limit');
// Background guidance must steer foreground-by-default, so the model doesn't
Expand Down