feat(native): add inspection primitives, dispatch traces and approved UI observation (#500)
* fix(hopper): normalize string-backed addresses and update verification * feat(native): add inspection primitives, dispatch traces and approved UI observation * test: prioritize real artifact E2E and captured golden regressions * fix(process): queue observed output before reactive rendering actions * test: prune redundant cases and strengthen boundary assertions * fix(cli): route native value tracing through shared workflows * test: replace synthetic success with real workflows and captured data * fix(catalog): separate portable metadata from native host availability
This commit is contained in:
@@ -4,6 +4,7 @@ import { McpServer } from "@modelcontextprotocol/server";
|
||||
|
||||
import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
|
||||
import { GENERATED_MCP_TOOL_CATALOG } from "../../../src/generatedMcpToolCatalog.js";
|
||||
import { annotationsFromEffects } from "../../../src/contracts/toolEffects.js";
|
||||
import { toolRegistrationOptions } from "../../../src/server/toolRegistrationOptions.js";
|
||||
|
||||
describe("tool registration options", () => {
|
||||
@@ -34,6 +35,28 @@ describe("tool registration options", () => {
|
||||
}));
|
||||
for (const contract of TOOL_CONTRACTS) {
|
||||
const tool = advertised.find(({ name }) => name === contract.name);
|
||||
expect(tool, contract.name).toBeDefined();
|
||||
expect(describesObject(tool?.inputSchema), contract.name).toBe(true);
|
||||
expect(describesObject(tool?.outputSchema), contract.name).toBe(true);
|
||||
expect(tool?.title?.trim().length, contract.name).toBeGreaterThan(0);
|
||||
expect(tool?.description?.trim().length, contract.name).toBeGreaterThan(
|
||||
0,
|
||||
);
|
||||
expect(JSON.stringify(tool?.outputSchema), contract.name).not.toContain(
|
||||
'"result":{}',
|
||||
);
|
||||
expect(tool?.annotations, contract.name).toEqual(
|
||||
annotationsFromEffects(contract.effects),
|
||||
);
|
||||
expect(contract.examples.length, contract.name).toBeGreaterThan(0);
|
||||
for (const example of contract.examples) {
|
||||
expect(example.title.trim().length, contract.name).toBeGreaterThan(0);
|
||||
expect(
|
||||
contract.inputSchema.safeParse(example.input).success,
|
||||
`${contract.name}: ${example.title}`,
|
||||
).toBe(true);
|
||||
}
|
||||
|
||||
expect(tool?.inputSchema.examples, contract.name).toEqual(
|
||||
contract.examples.map(({ input }) => input),
|
||||
);
|
||||
@@ -42,12 +65,6 @@ describe("tool registration options", () => {
|
||||
contract.name,
|
||||
).toEqual([]);
|
||||
}
|
||||
const analyzeFunction = advertised.find(
|
||||
({ name }) => name === "analyze_function",
|
||||
);
|
||||
expect(analyzeFunction?.inputSchema.properties).toEqual({
|
||||
procedure: expect.objectContaining({ type: "string" }),
|
||||
});
|
||||
expect(advertised).toEqual(
|
||||
GENERATED_MCP_TOOL_CATALOG.map((tool) => ({
|
||||
name: tool.name,
|
||||
@@ -96,3 +113,18 @@ const missingPropertyDescriptions = (
|
||||
|
||||
const isObject = (value: unknown): value is Readonly<Record<string, unknown>> =>
|
||||
typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
|
||||
const describesObject = (schema: unknown): boolean => {
|
||||
if (!isObject(schema)) return false;
|
||||
return (
|
||||
schema.type === "object" ||
|
||||
[schema.oneOf, schema.anyOf].some(
|
||||
(variants) =>
|
||||
Array.isArray(variants) &&
|
||||
variants.length > 0 &&
|
||||
variants.every(
|
||||
(variant: unknown) => isObject(variant) && variant.type === "object",
|
||||
),
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user