Skip to content

Commit 624d538

Browse files
jesseturner21claude
andcommitted
refactor(schema): rename agentName to runtimeName in MCP bindings and make type optional
- Rename `agentName` to `runtimeName` in McpRuntimeBindingSchema and all consuming code (attach.ts, llm-compacted types, JSON schema) - Make `type: "AgentCoreRuntime"` optional on AgentEnvSpec for backward compatibility; stop emitting it in new runtime configs - Update tests to match new schema shape Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 84bb49d commit 624d538

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

schemas/agentcore.schema.v1.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@
12561256
"items": {
12571257
"type": "object",
12581258
"properties": {
1259-
"agentName": {
1259+
"runtimeName": {
12601260
"type": "string",
12611261
"minLength": 1
12621262
},
@@ -1267,7 +1267,7 @@
12671267
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
12681268
}
12691269
},
1270-
"required": ["agentName", "envVarName"],
1270+
"required": ["runtimeName", "envVarName"],
12711271
"additionalProperties": false
12721272
}
12731273
}

src/cli/operations/agent/generate/__tests__/schema-mapper.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe('mapModelProviderToCredentials', () => {
101101
});
102102

103103
describe('mapGenerateConfigToAgent', () => {
104-
it('creates AgentCoreRuntime agent spec', () => {
104+
it('creates agent spec', () => {
105105
const result = mapGenerateConfigToAgent(baseConfig);
106106
expect(result.name).toBe('TestProject');
107107
expect(result.build).toBe('CodeZip');

src/cli/operations/attach.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export async function getGateways(): Promise<string[]> {
7676
// ─────────────────────────────────────────────────────────────────────────────
7777

7878
export interface BindMcpRuntimeConfig {
79-
agentName: string;
79+
runtimeName: string;
8080
envVarName: string;
8181
}
8282

@@ -87,11 +87,11 @@ export interface BindMcpRuntimeConfig {
8787
export async function bindMcpRuntimeToAgent(mcpRuntimeName: string, config: BindMcpRuntimeConfig): Promise<void> {
8888
const configIO = new ConfigIO();
8989

90-
// Validate the agent exists
90+
// Validate the runtime exists
9191
const project = await configIO.readProjectSpec();
92-
const agent = project.runtimes.find(a => a.name === config.agentName);
92+
const agent = project.runtimes.find(a => a.name === config.runtimeName);
9393
if (!agent) {
94-
throw new Error(`Agent "${config.agentName}" not found.`);
94+
throw new Error(`Runtime "${config.runtimeName}" not found.`);
9595
}
9696

9797
// Find the MCP runtime tool
@@ -104,12 +104,12 @@ export async function bindMcpRuntimeToAgent(mcpRuntimeName: string, config: Bind
104104
runtimeTool.bindings ??= [];
105105

106106
// Check if already bound
107-
if (runtimeTool.bindings.some(b => b.agentName === config.agentName)) {
108-
throw new Error(`Agent "${config.agentName}" is already bound to MCP runtime "${mcpRuntimeName}".`);
107+
if (runtimeTool.bindings.some(b => b.runtimeName === config.runtimeName)) {
108+
throw new Error(`Runtime "${config.runtimeName}" is already bound to MCP runtime "${mcpRuntimeName}".`);
109109
}
110110

111111
const binding: McpRuntimeBinding = {
112-
agentName: config.agentName,
112+
runtimeName: config.runtimeName,
113113
envVarName: config.envVarName,
114114
};
115115

src/schema/llm-compacted/mcp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ interface AgentCoreMcpRuntimeTool {
8585
}
8686

8787
/**
88-
* Binding from an MCP runtime tool to an agent.
88+
* Binding from an MCP runtime tool to a runtime.
8989
* When present, the agent is granted InvokeAgentRuntime permission
9090
* and receives the runtime ARN in the specified environment variable.
9191
*/
9292
interface McpRuntimeBinding {
93-
agentName: string; // @min 1 - name of the agent from spec.runtimes array
93+
runtimeName: string; // @min 1 - name of the runtime from spec.runtimes array
9494
envVarName: string; // @regex ^[A-Za-z_][A-Za-z0-9_]*$ @max 255 - env var for runtime ARN
9595
}
9696

src/schema/schemas/__tests__/mcp.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ describe('AgentCoreMcpRuntimeToolSchema', () => {
508508
it('accepts tool with bindings', () => {
509509
const result = AgentCoreMcpRuntimeToolSchema.safeParse({
510510
...validTool,
511-
bindings: [{ agentName: 'Agent1', envVarName: 'TOOL_ARN' }],
511+
bindings: [{ runtimeName: 'Agent1', envVarName: 'TOOL_ARN' }],
512512
});
513513
expect(result.success).toBe(true);
514514
});

src/schema/schemas/mcp.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,13 +616,13 @@ export type AgentCoreGateway = z.infer<typeof AgentCoreGatewaySchema>;
616616
// ============================================================================
617617

618618
/**
619-
* Binding from an MCP runtime tool to an agent.
620-
* When present, the agent is granted InvokeAgentRuntime permission
619+
* Binding from an MCP runtime tool to a runtime.
620+
* When present, the runtime is granted InvokeAgentRuntime permission
621621
* and receives the runtime ARN in the specified environment variable.
622622
*/
623623
export const McpRuntimeBindingSchema = z
624624
.object({
625-
agentName: z.string().min(1),
625+
runtimeName: z.string().min(1),
626626
envVarName: EnvVarNameSchema,
627627
})
628628
.strict();

0 commit comments

Comments
 (0)