Configuration object for the discovery extension
A discovery extension object with both info and schema
// For a GET endpoint with no input
const getExtension = declareDiscoveryExtension({
method: "GET",
output: {
example: { message: "Success", timestamp: "2024-01-01T00:00:00Z" }
}
});
// For a GET endpoint with query params
const getWithParams = declareDiscoveryExtension({
method: "GET",
input: { query: "example" },
inputSchema: {
properties: {
query: { type: "string" }
},
required: ["query"]
}
});
// For a POST endpoint with JSON body
const postExtension = declareDiscoveryExtension({
method: "POST",
input: { name: "John", age: 30 },
inputSchema: {
properties: {
name: { type: "string" },
age: { type: "number" }
},
required: ["name"]
},
bodyType: "json",
output: {
example: { success: true, id: "123" }
}
});
Create a discovery extension for any HTTP method
This function helps servers declare how their endpoint should be called, including the expected input parameters/body and output format.