Merge branch 'main' into fix/validate-json-on-tool-execution
This commit is contained in:
commit
bd7c753c4b
6 changed files with 89 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@modelcontextprotocol/inspector-cli",
|
"name": "@modelcontextprotocol/inspector-cli",
|
||||||
"version": "0.15.0",
|
"version": "0.16.0",
|
||||||
"description": "CLI for the Model Context Protocol inspector",
|
"description": "CLI for the Model Context Protocol inspector",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Anthropic, PBC (https://anthropic.com)",
|
"author": "Anthropic, PBC (https://anthropic.com)",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@modelcontextprotocol/inspector-client",
|
"name": "@modelcontextprotocol/inspector-client",
|
||||||
"version": "0.15.0",
|
"version": "0.16.0",
|
||||||
"description": "Client-side application for the Model Context Protocol inspector",
|
"description": "Client-side application for the Model Context Protocol inspector",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Anthropic, PBC (https://anthropic.com)",
|
"author": "Anthropic, PBC (https://anthropic.com)",
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,11 @@ describe("DynamicJsonForm Complex Fields", () => {
|
||||||
const input = screen.getByRole("textbox");
|
const input = screen.getByRole("textbox");
|
||||||
expect(input).toHaveProperty("type", "textarea");
|
expect(input).toHaveProperty("type", "textarea");
|
||||||
const buttons = screen.getAllByRole("button");
|
const buttons = screen.getAllByRole("button");
|
||||||
expect(buttons).toHaveLength(1);
|
expect(buttons).toHaveLength(2); // Copy JSON + Format JSON
|
||||||
expect(buttons[0]).toHaveProperty("textContent", "Format JSON");
|
const copyButton = screen.getByRole("button", { name: /copy json/i });
|
||||||
|
const formatButton = screen.getByRole("button", { name: /format json/i });
|
||||||
|
expect(copyButton).toBeTruthy();
|
||||||
|
expect(formatButton).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should pass changed values to onChange", () => {
|
it("should pass changed values to onChange", () => {
|
||||||
|
|
@ -137,3 +140,72 @@ describe("DynamicJsonForm Complex Fields", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("DynamicJsonForm Copy JSON Functionality", () => {
|
||||||
|
const mockWriteText = jest.fn(() => Promise.resolve());
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
Object.assign(navigator, {
|
||||||
|
clipboard: {
|
||||||
|
writeText: mockWriteText,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const renderFormInJsonMode = (props = {}) => {
|
||||||
|
const defaultProps = {
|
||||||
|
schema: {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
nested: { oneOf: [{ type: "string" }, { type: "integer" }] },
|
||||||
|
},
|
||||||
|
} as unknown as JsonSchemaType,
|
||||||
|
value: { nested: "test value" },
|
||||||
|
onChange: jest.fn(),
|
||||||
|
};
|
||||||
|
return render(<DynamicJsonForm {...defaultProps} {...props} />);
|
||||||
|
};
|
||||||
|
|
||||||
|
describe("Copy JSON Button", () => {
|
||||||
|
it("should render Copy JSON button when in JSON mode", () => {
|
||||||
|
renderFormInJsonMode();
|
||||||
|
|
||||||
|
const copyButton = screen.getByRole("button", { name: "Copy JSON" });
|
||||||
|
expect(copyButton).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not render Copy JSON button when not in JSON mode", () => {
|
||||||
|
const simpleSchema = {
|
||||||
|
type: "string" as const,
|
||||||
|
description: "Test string field",
|
||||||
|
};
|
||||||
|
|
||||||
|
render(
|
||||||
|
<DynamicJsonForm
|
||||||
|
schema={simpleSchema}
|
||||||
|
value="test"
|
||||||
|
onChange={jest.fn()}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
const copyButton = screen.queryByRole("button", { name: "Copy JSON" });
|
||||||
|
expect(copyButton).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should copy JSON to clipboard when clicked", async () => {
|
||||||
|
const testValue = { nested: "test value", number: 42 };
|
||||||
|
|
||||||
|
renderFormInJsonMode({ value: testValue });
|
||||||
|
|
||||||
|
const copyButton = screen.getByRole("button", { name: "Copy JSON" });
|
||||||
|
fireEvent.click(copyButton);
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(mockWriteText).toHaveBeenCalledWith(
|
||||||
|
JSON.stringify(testValue, null, 2),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
16
package-lock.json
generated
16
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@modelcontextprotocol/inspector",
|
"name": "@modelcontextprotocol/inspector",
|
||||||
"version": "0.15.0",
|
"version": "0.16.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@modelcontextprotocol/inspector",
|
"name": "@modelcontextprotocol/inspector",
|
||||||
"version": "0.15.0",
|
"version": "0.16.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"client",
|
"client",
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
"cli"
|
"cli"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/inspector-cli": "^0.15.0",
|
"@modelcontextprotocol/inspector-cli": "^0.16.0",
|
||||||
"@modelcontextprotocol/inspector-client": "^0.15.0",
|
"@modelcontextprotocol/inspector-client": "^0.16.0",
|
||||||
"@modelcontextprotocol/inspector-server": "^0.15.0",
|
"@modelcontextprotocol/inspector-server": "^0.16.0",
|
||||||
"@modelcontextprotocol/sdk": "^1.13.1",
|
"@modelcontextprotocol/sdk": "^1.13.1",
|
||||||
"concurrently": "^9.0.1",
|
"concurrently": "^9.0.1",
|
||||||
"open": "^10.1.0",
|
"open": "^10.1.0",
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
},
|
},
|
||||||
"cli": {
|
"cli": {
|
||||||
"name": "@modelcontextprotocol/inspector-cli",
|
"name": "@modelcontextprotocol/inspector-cli",
|
||||||
"version": "0.15.0",
|
"version": "0.16.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.13.1",
|
"@modelcontextprotocol/sdk": "^1.13.1",
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
},
|
},
|
||||||
"client": {
|
"client": {
|
||||||
"name": "@modelcontextprotocol/inspector-client",
|
"name": "@modelcontextprotocol/inspector-client",
|
||||||
"version": "0.15.0",
|
"version": "0.16.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.13.1",
|
"@modelcontextprotocol/sdk": "^1.13.1",
|
||||||
|
|
@ -10987,7 +10987,7 @@
|
||||||
},
|
},
|
||||||
"server": {
|
"server": {
|
||||||
"name": "@modelcontextprotocol/inspector-server",
|
"name": "@modelcontextprotocol/inspector-server",
|
||||||
"version": "0.15.0",
|
"version": "0.16.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.13.1",
|
"@modelcontextprotocol/sdk": "^1.13.1",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@modelcontextprotocol/inspector",
|
"name": "@modelcontextprotocol/inspector",
|
||||||
"version": "0.15.0",
|
"version": "0.16.0",
|
||||||
"description": "Model Context Protocol inspector",
|
"description": "Model Context Protocol inspector",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Anthropic, PBC (https://anthropic.com)",
|
"author": "Anthropic, PBC (https://anthropic.com)",
|
||||||
|
|
@ -44,9 +44,9 @@
|
||||||
"check-version": "node scripts/check-version-consistency.js"
|
"check-version": "node scripts/check-version-consistency.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/inspector-cli": "^0.15.0",
|
"@modelcontextprotocol/inspector-cli": "^0.16.0",
|
||||||
"@modelcontextprotocol/inspector-client": "^0.15.0",
|
"@modelcontextprotocol/inspector-client": "^0.16.0",
|
||||||
"@modelcontextprotocol/inspector-server": "^0.15.0",
|
"@modelcontextprotocol/inspector-server": "^0.16.0",
|
||||||
"@modelcontextprotocol/sdk": "^1.13.1",
|
"@modelcontextprotocol/sdk": "^1.13.1",
|
||||||
"concurrently": "^9.0.1",
|
"concurrently": "^9.0.1",
|
||||||
"open": "^10.1.0",
|
"open": "^10.1.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@modelcontextprotocol/inspector-server",
|
"name": "@modelcontextprotocol/inspector-server",
|
||||||
"version": "0.15.0",
|
"version": "0.16.0",
|
||||||
"description": "Server-side application for the Model Context Protocol inspector",
|
"description": "Server-side application for the Model Context Protocol inspector",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Anthropic, PBC (https://anthropic.com)",
|
"author": "Anthropic, PBC (https://anthropic.com)",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue