local url = os.getenv("MCP_HTTP_URL")
assert(url and url ~= "", "MCP_HTTP_URL must be set")
mcp.connect_http("counter", url)
print("CONNECT_HTTP_OK")
local lt = mcp.list_tools("counter")
assert(lt.ok == true, "list_tools ok=false: " .. tostring(lt.error))
assert(type(lt.tools) == "table", "tools must be a table")
assert(#lt.tools >= 1, "expected at least 1 tool, got " .. #lt.tools)
local found = false
for _, t in ipairs(lt.tools) do
if t.name == "increment" then
found = true
break
end
end
assert(found, "increment tool not found in list_tools response")
print("LIST_TOOLS_OK")
local call = mcp.call("counter", "increment", {})
assert(call.ok == true, "call_tool ok=false: " .. tostring(call.error))
local shape_check = require("lshape").check
local mcp_call_result = require("agent").shapes.mcp_call_result
local shape_ok, why = shape_check.check(call, mcp_call_result)
assert(shape_ok, "mcp.call result violated its shape: " .. tostring(why))
print("CALL_TOOL_SHAPE_OK")
print("FIXTURE_DONE")