Skip to content
Merged
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
55 changes: 55 additions & 0 deletions ast-grep-rule-tests/no-expand-top-level-tools-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
id: no-expand-top-level-tools
valid:
- |
export const TOP_LEVEL_TOOL_NAMES = [
"find_organizations",
"find_projects",
"update_issue",
"search_errors",
"search_logs",
"search_traces",
"search_metrics",
"search_profiles",
"search_replays",
"analyze_issue_with_seer",
"search_issues",
"get_sentry_resource",
...CATALOG_INFRASTRUCTURE_TOOL_NAMES,
] as const;
- |
export const EXPERIMENTAL_TOP_LEVEL_TOOL_NAMES = TOP_LEVEL_TOOL_NAMES;
invalid:
- |
export const TOP_LEVEL_TOOL_NAMES = [
"find_organizations",
"find_projects",
"update_issue",
"search_errors",
"search_logs",
"search_traces",
"search_metrics",
"search_profiles",
"search_replays",
"find_dropped_events",
"analyze_issue_with_seer",
"search_issues",
"get_sentry_resource",
...CATALOG_INFRASTRUCTURE_TOOL_NAMES,
] as const;
- |
export const TOP_LEVEL_TOOL_NAMES = [
"find_organizations",
"find_projects",
"update_issue",
"search_errors",
"search_logs",
"search_traces",
"search_metrics",
"search_profiles",
"search_replays",
"analyze_issue_with_seer",
"search_issues",
"get_sentry_resource",
...CATALOG_INFRASTRUCTURE_TOOL_NAMES,
...EXTRA_TOOL_NAMES,
] as const;
39 changes: 39 additions & 0 deletions ast-grep-rules/no-expand-top-level-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
id: no-expand-top-level-tools
language: TypeScript
severity: error
message: Do not change the default top-level MCP tool list.
note: |
Every tool in TOP_LEVEL_TOOL_NAMES ships in the default tools/list payload.
Many harnesses still load every listed tool definition into the context
window up front, so each addition is noise for every session. Keep new tools
deferred: they stay reachable through search_sentry_tools and
execute_sentry_tool. Restricted until tool search is standard in every
mainstream harness, which likely happens by 2027. If the list truly must
change, update the allowed list in this rule in the same PR so the change is
reviewed explicitly.
rule:
kind: lexical_declaration
has:
kind: variable_declarator
has:
field: name
regex: ^TOP_LEVEL_TOOL_NAMES$
not:
pattern: |
const TOP_LEVEL_TOOL_NAMES = [
"find_organizations",
"find_projects",
"update_issue",
"search_errors",
"search_logs",
"search_traces",
"search_metrics",
"search_profiles",
"search_replays",
"analyze_issue_with_seer",
"search_issues",
"get_sentry_resource",
...CATALOG_INFRASTRUCTURE_TOOL_NAMES
] as const
files:
- packages/mcp-core/src/tools/surfaces.ts
1 change: 0 additions & 1 deletion packages/mcp-core/src/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ async function callRegisteredTool(
const DEFAULT_DIRECT_TOOL_NAMES = [
"analyze_issue_with_seer",
"execute_sentry_tool",
"find_dropped_events",
"find_organizations",
"find_projects",
"get_sentry_resource",
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-core/src/toolDefinitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@
},
"requiredScopes": ["event:read"],
"skills": ["inspect"],
"surface": "direct"
"surface": "catalog"
},
{
"name": "find_dsns",
Expand Down
6 changes: 5 additions & 1 deletion packages/mcp-core/src/tools/surfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export const CATALOG_INFRASTRUCTURE_TOOL_NAMES = [

export const WRAPPER_TOOL_NAMES = [] as const;

// Locked by ast-grep-rules/no-expand-top-level-tools.yml. Every name here ships
// in the default tools/list payload, and many harnesses still load every listed
// tool into the context window up front. New tools stay deferred behind
// search_sentry_tools/execute_sentry_tool. Restricted until tool search is
// standard in every mainstream harness, which likely happens by 2027.
export const TOP_LEVEL_TOOL_NAMES = [
"find_organizations",
"find_projects",
Expand All @@ -24,7 +29,6 @@ export const TOP_LEVEL_TOOL_NAMES = [
"search_metrics",
"search_profiles",
"search_replays",
"find_dropped_events",
"analyze_issue_with_seer",
"search_issues",
"get_sentry_resource",
Expand Down
1 change: 0 additions & 1 deletion plugins/sentry-mcp-experimental/agents/sentry-mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mcpServers:
allowedTools:
- analyze_issue_with_seer
- execute_sentry_tool
- find_dropped_events
- find_organizations
- find_projects
- get_sentry_resource
Expand Down
1 change: 0 additions & 1 deletion plugins/sentry-mcp/agents/sentry-mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mcpServers:
allowedTools:
- analyze_issue_with_seer
- execute_sentry_tool
- find_dropped_events
- find_organizations
- find_projects
- get_sentry_resource
Expand Down
Loading