게시일: 2026년 11월 26일
| 설명하듯이 | 웹 | 확장 프로그램 | Chrome 상태 | 의도 |
|---|---|---|---|---|
| GitHub | View | 실험 의도 |
이 페이지를 따라 Chrome 출시 전반에 걸쳐 WebMCP의 API 추가, 동작 변경사항, 브레이킹 체인지를 추적하세요.
이전 출시의 코드 예는 각 변경 시점의 API 형태를 반영합니다. 최신 사용법은 명령형 API 및 선언적 API 문서를 참고하세요.
Chrome 160
RegisteredTool 사전을 대체하는 새 Tool 인터페이스
PR #348에 따라 getTools()에서 반환하는 객체는 이제 RegisteredTool 사전 대신 새 Tool 인터페이스의 인스턴스입니다. 또한 도구를 등록한 문서의 창을 노출하는 window 멤버는 이제 source라고 합니다. 이 변경사항은 Chrome 160.0.8173.0부터 적용됩니다.
getTools()에서 반환하는 각 Tool에는 고유한 내부 ID가 있습니다. executeTool()는 이 ID를 참조하여 도구를 실행합니다. 이렇게 하면 도구가 실행되는 동안 등록 취소되는 것과 같은 여러 경합 상태가 해결됩니다. 또한 불투명 출처 문서에 의해 등록된 도구를 실행하고 향후 작업자 통합을 준비합니다.
Tool는 이제 인터페이스 객체이므로 다음과 같은 추가 호환성 변경사항에 유의하세요.
- 비어 있으면
inputSchema,outputSchema,annotations가 이제undefined대신null입니다. JSON.stringify(tool)는"{}"를 반환하고 스프레드 연산자({...tool})는 아무것도 복사하지 않습니다. 대신 필요한 속성을 명시적으로 읽습니다.Tool은 직렬화할 수 없으므로structuredClone(tool)에서 예외가 발생합니다.
다음 예시에서는 이전 RegisteredTool 사전과의 하위 호환성을 유지하면서 도구의 속성을 읽습니다.
const tools = await document.modelContext.getTools();
for (const tool of tools) {
// TODO: Remove `tool.window` fallback when Chrome 160 reaches Stable (January 5, 2027).
const source = tool.source ?? tool.window;
// Use explicit properties rather than JSON.stringify(tool) or {...tool}.
const { name, title, description, origin } = tool;
const inputSchema = tool.inputSchema ?? null;
const outputSchema = tool.outputSchema ?? null;
const annotations = tool.annotations ?? null;
console.log({ name, title, description, origin, inputSchema, outputSchema, annotations, source });
}
Chrome 159
registerTool에 outputSchema 지원 추가
Chrome 159.0.8140.0부터 document.modelContext.registerTool()는 선택적 outputSchema 속성을 지원합니다. inputSchema가 매개변수를 설명하는 것과 동일한 방식으로 도구의 반환 값에 대한 JSON 스키마를 선언하는 데 사용합니다. 사양 변경사항은 PR #254에 있습니다.
사양은 도구의 출력이 outputSchema와 일치하지 않을 때 executeTool()가 실패하는지 여부를 아직 정의하지 않습니다(문제 #92 참고). 현재로서는 에이전트 하네스가 각 도구의 출력을 모델에 반환하기 전에 outputSchema와 비교하여 확인해야 합니다. 일치하지 않으면 모델에 잘못된 형식의 데이터 대신 명확한 검증 오류를 전송합니다. 예시는 webmcp-extension PR #98을 참고하세요.
await document.modelContext.registerTool({
name: "getWeather",
description: "Returns the current weather for a city.",
inputSchema: {
type: "object",
properties: { city: { type: "string" } },
required: ["city"]
},
outputSchema: {
type: "object",
properties: {
temperature: { type: "number" },
conditions: { type: "string" }
},
required: ["temperature", "conditions"]
},
async execute({ city }) { /* ... */ }
});
Chrome 156
ontoolactivated 및 ontoolcancel을 document.modelContext로 재배치
Chrome 156.0.8076.0부터 ontoolactivated 및 ontoolcancel 이벤트 핸들러 속성이 window에서 document.modelContext로 이동합니다(PR #245 참고). 이러한 이벤트 핸들러는 각각 도구 실행이 시작되는 시점과 취소되는 시점을 나타냅니다.
다음 예에서는 기존 이벤트 핸들러와의 하위 호환성을 유지하면서 두 이벤트를 모두 처리합니다.
const targetFor = (type, listener, options) =>
(`on${type}` in (document.modelContext ?? {}) ? document.modelContext : window)
.addEventListener(type, listener, options);
targetFor("toolactivated", ({ toolName }) => {
console.log(`Tool "${toolName}" started execution.`);
});
targetFor("toolcancel", ({ toolName }) => {
console.log(`Tool "${toolName}" execution is cancelled.`);
});
ToolAnnotations에 디버깅 구성원 추가
Chrome 156.0.8067.0부터 ToolAnnotations에 새로운 debugging 멤버가 포함됩니다.
개발자 도구의 도구를 등록할 때 debugging를 true로 설정합니다. 여기에는 검사, 프레임워크 테스트, Chrome DevTools AI 지원이 포함됩니다.
이렇게 하면 범용 및 최종 사용자 에이전트가 개발자 중심 도구를 필터링하는 데 도움이 됩니다. 전체 기술 세부정보는 PR #253에서 확인할 수 있습니다.
await document.modelContext.registerTool({
name: "getInternalState",
description: "Returns internal component state for diagnostics and troubleshooting.",
inputSchema: {
type: "object",
properties: { componentId: { type: "string", description: "ID of the component to inspect" } },
required: ["componentId"],
},
execute: ({ componentId }) => {
return myFramework.getState(componentId);
},
annotations: {
readOnlyHint: true,
debugging: true, // Diagnostic tool intended for troubleshooting
},
});
Chrome 155
executeTool 입력 인수 유형 변경
PR #246 및 PR #251에 따라 executeTool()의 입력 인수 유형이 DOMString에서 Chrome 155.0.8052.0의 선택적 JavaScript 객체로 변경되었습니다.
이전에는 executeTool()에 문자열화된 입력 인수가 필요했습니다. 선택적 JavaScript 객체를 직접 허용하면 JSON.stringify()를 수동으로 호출하지 않아도 되며 ToolExecuteCallback의 inputObject와 일치합니다. 이제 입력 객체가 유효한 JavaScript 객체가 아니거나 JSON 문자열로 직렬화할 수 없는 경우 executeTool()에서 반환된 프로미스가 거부됩니다.
다음 예시에서는 기존 문자열화된 입력 인수에 대한 하위 호환성을 유지하면서 입력 객체를 전달합니다.
const inputObject = { answer: 42 };
let result;
try {
result = await document.modelContext.executeTool(myTool, inputObject);
} catch (e) {
// TODO: Remove when executeTool doesn't accept JSON stringified inputArgs in Chrome Stable.
if (e.message.startsWith("Failed to parse input")) {
result = await document.modelContext.executeTool(myTool, JSON.stringify(inputObject));
} else {
throw e;
}
}
RegisteredTool inputSchema 유형 변경
PR #241에 따라 RegisteredTool의 inputSchema 속성 유형이 DOMString에서 Chrome 155.0.8051.0의 JavaScript 객체로 변경되었습니다.
이 변경사항은 처음에 Chrome 154.0.8014.0에 적용되었다가 일시적으로 되돌려졌습니다.
이전에는 등록 중에 ModelContextTool#inputSchema가 객체로 정의되었지만 getTools()를 사용하여 검색할 때 RegisteredTool#inputSchema가 문자열화된 JSON 스키마(DOMString)를 반환했습니다. 이 변경사항은 RegisteredTool#inputSchema가 항상 등록 시 제공된 스키마의 전체 사본인 JavaScript 객체를 반환하도록 하여 이러한 불일치를 해결합니다.
다음 예시에서는 기존 문자열화된 JSON 스키마의 하위 호환성을 유지하면서 inputSchema를 객체로 처리합니다.
const [tool] = await document.modelContext.getTools();
const inputSchemaObject =
typeof tool.inputSchema === "string" ? JSON.parse(tool.inputSchema) : tool.inputSchema;
Chrome 154
ToolAnnotations에 consequentialHint 멤버 추가
Chrome 154.0.8017.0부터 ToolAnnotations에 새로운 consequentialHint 멤버가 포함됩니다.
항공편 예약, 자금 이체, 데이터 삭제와 같이 중요하거나 되돌릴 수 없거나 실제 작업을 수행하는 도구를 등록할 때는 consequentialHint를 true로 설정합니다. 이 힌트는 에이전트가 실행 전에 명시적인 사용자 확인을 요구하도록 신호를 보내 의도하지 않거나 승인되지 않은 작업을 방지하는 데 도움이 됩니다. 자세한 기술 세부정보는 문제 #176을 참고하세요.
await document.modelContext.registerTool({
name: 'book_flight',
description: 'Book a flight for the user with confirmed flight details.',
inputSchema: {
type: 'object',
properties: {
flightId: { type: 'string', description: 'ID of the flight to book' },
passengers: { type: 'number', description: 'Number of tickets to purchase' },
},
required: ['flightId', 'passengers'],
},
annotations: {
readOnlyHint: false,
consequentialHint: true,
untrustedContentHint: false,
},
execute: async ({ flightId, passengers }) => {
// Add your flight booking transaction logic here.
return `Booked ${passengers} passenger(s) on flight ${flightId}.`;
},
});
Chrome 153
ModelContextTool execute 함수에 AbortSignal 전달
Chrome 153.0.8009.0부터 document.modelContext.registerTool()를 사용하여 등록된 도구의 execute 함수는 항상 두 번째 인수로 signal를 수신하여 서명을 execute(inputObject, { signal })로 변경합니다.
자세한 기술 세부정보는 문제 #48 및 PR #247을 참고하세요.
이렇게 하면 도구가 사용자 또는 에이전트가 시작한 실행 취소를 원활하게 처리할 수 있습니다. 이 신호를 장기 실행 비동기 작업이나 네트워크 작업(예: fetch())에 전달하면 불필요한 작업을 방지하고 전반적인 리소스 관리를 개선하며 잠재적인 누수를 방지할 수 있습니다.
또한 도구를 등록 해제해도 더 이상 실행 중인 실행이 자동으로 취소되지 않으므로 구성요소 프레임워크에서 도구 수명 주기를 관리할 때 예기치 않은 부작용이 발생하지 않습니다.
다음 예에서는 실행이 취소될 때 네트워크 활동이 즉시 중단되도록 signal를 fetch() 요청에 전달합니다. 선언적 API 사용은 PR #321을 참고하세요.
await document.modelContext.registerTool({
name: "fetch_tool",
description: "Fetch the text content of a URL and stream the response.",
inputSchema: {
type: "object",
properties: {
url: { type: "string", description: "The URL to fetch" },
priority: { type: "string", enum: ["high", "low", "auto"] },
},
required: ["url"],
},
execute: async ({ url, priority }, { signal }) => {
// Abort the fetch request when tool execution is aborted.
const response = await fetch(url, { priority, signal });
const stream = response.body.pipeThrough(new TextDecoderStream());
for await (const chunk of stream) {
document.querySelector("pre").textContent += chunk;
}
return "Success";
},
});
Chrome 152
navigator.modelContext 삭제
Chrome 150에서 지원 중단된 navigator.modelContext가 Chrome 152.0.7943.0부터 삭제됩니다.
대신 document.modelContext를 사용하세요.
Chrome 151
registerTool에서 Promise 반환
document.modelContext.registerTool() 메서드는 Chrome 151.0.7922.0부터 Promise를 반환합니다.
문제 #175에 자세히 설명된 이 변경사항은 교차 출처 iframe 통합을 통해 프레임 트리에서 도구를 공유할 수 있으므로 등록이 기본적으로 비동기식으로 이루어지기 때문에 필요합니다. Promise는 도구가 다른 문서의 getTools()에서 실제로 사용 가능한 경우에만 확인되므로 API가 발전함에 따라 오류 처리가 개선되고 향후 호환성이 보장됩니다.
다음 예에 표시된 비동기 패턴을 사용하도록 코드를 업데이트합니다. 실제 예시는 PR #228에서 WebMCP 데모가 어떻게 업데이트되었는지 참고하세요.
try {
await document.modelContext.registerTool(myTool);
} catch (e) {
console.error('Tool registration failed:', e);
}
Chrome 150
document.modelContext를 위해 navigator.modelContext 지원 중단
도구가 문서별로 효과적이라는 사실에 맞추기 위해 WebML CG는 modelContext getter를 Navigator 인터페이스에서 Document 인터페이스로 이동하기로 합의했습니다. 자세한 기술 세부정보는 문제 #173 및 PR #184를 참고하세요.
navigator.modelContext은 Chrome 150.0.7861.0부터 지원 중단되었으며 이후 Chrome 152에서 삭제되었습니다. 대신 document.modelContext를 사용합니다.
다음 기능 감지 패턴은 이동 전후의 Chrome 출시 버전 간에 호환성을 유지합니다. 실제 예시는 PR #189에서 WebMCP 데모가 어떻게 업데이트되었는지 참고하세요.
const modelContext = document.modelContext || navigator.modelContext;
if (modelContext) {
// Register tools...
}
Chrome 149
ToolAnnotations에 untrustedContentHint 구성원 추가
Chrome 149.0.7810.0부터 ToolAnnotations에 새로운 untrustedContentHint 멤버가 포함됩니다.
도구가 외부 또는 확인되지 않은 소스의 데이터를 처리하는 경우 untrustedContentHint를 true로 명시적으로 설정하여 도구의 출력에 도구를 등록하는 작성자의 관점에서 신뢰할 수 없는 데이터가 포함되어 있음을 나타냅니다. 자세한 기술 세부정보는 문제 #136에서 확인할 수 있습니다.
navigator.modelContext.registerTool({
name: "addTodo",
description: "Add a new item to the todo list",
inputSchema: {
type: "object",
properties: { text: { type: "string" } },
},
execute: ({ text }) => {
// You should handle the persistence logic here (omitted for demo)
return `Added todo: ${text}`;
},
annotations: { readOnlyHint: false, untrustedContentHint: true },
});
Chrome 148
registerTool에서 unregisterTool을 AbortSignal로 대체
WebML CG는 도구 등록 취소에 이벤트 리스너 등록 취소와 동일한 수준의 소유권이 필요하다는 데 동의했습니다. 스크립트가 자신이 만들지 않은 도구를 실수로 또는 악의적으로 등록 취소하지 못하도록 unregisterTool()가 삭제됩니다.
Chrome 148.0.7757.0부터 registerTool()는 선택적 AbortSignal를 지원합니다. 이 신호를 중단하면 도구 등록이 취소됩니다. 전체 기술 세부정보는 PR #147에서 확인할 수 있습니다.
출시 버전 간 호환성을 유지하려면 다음 예시와 유사한 래퍼를 사용하세요. PR #104를 참고하여 WebMCP 데모가 어떻게 업데이트되었는지 확인할 수도 있습니다.
const controller = new AbortController();
navigator.modelContext.registerTool(myTool, { signal: controller.signal });
// Unregister tool later...
navigator.modelContext.unregisterTool?.(myTool.name);
controller.abort();
toolparamtitle 속성 삭제
Chrome 148.0.7730.0부터 toolparamtitle 속성이 삭제됩니다. WebML CG의 PR #76에서 설명한 대로 합성된 JSON 스키마의 title 필드에 더 이상 아무것도 기여하지 않습니다. 이 목적으로 표준 HTML <label> 요소를 사용하는 것은 향후에도 가능합니다.
Chrome 147
provideContext 및 clearContext 삭제
WebMCP API 형태를 개선하기 위해 provideContext() 및 clearContext() 메서드가 Chrome 147.0.7721.0에서 삭제되었습니다.
문제 #101에 자세히 설명된 이 변경사항은 두 가지 주요 아키텍처 문제를 해결합니다.
- 새 도구를 등록하기 전에 기존 도구를 삭제함으로써
provideContext()는 서드 파티 스크립트가 의도치 않게 또는 악의적으로 공식 도구를 덮어쓰고 사용자 에이전트 상호작용을 가로챌 수 있는 보안 위험을 초래했습니다. - '모두 삭제' 패턴은 웹 API에서 일반적이지 않다는 의견이 있었습니다.
개발자는 스크립트가 자체 등록을 독립적으로 관리할 수 있는
addEventListener와 유사한 추가 모델을 선호했습니다.
더 세분화되고 안전한 제어를 유지하려면 registerTool() 및 unregisterTool()(나중에 Chrome 148에서 AbortSignal로 대체됨)를 사용하세요.