fix(test): skip serialize tool's annotation if empty (#160)
* fix(test): skip serialize tool's annotation if empty 1. skip serialize tool's annotation if empty 2. close js server and client when close * fix(test): fix test with js, don't close too early
This commit is contained in:
parent
afb8a905e5
commit
09474d4769
3 changed files with 4 additions and 2 deletions
|
|
@ -18,6 +18,7 @@ pub struct Tool {
|
||||||
pub description: Option<Cow<'static, str>>,
|
pub description: Option<Cow<'static, str>>,
|
||||||
/// A JSON Schema object defining the expected parameters for the tool
|
/// A JSON Schema object defining the expected parameters for the tool
|
||||||
pub input_schema: Arc<JsonObject>,
|
pub input_schema: Arc<JsonObject>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
/// Optional additional tool information.
|
/// Optional additional tool information.
|
||||||
pub annotations: Option<ToolAnnotations>,
|
pub annotations: Option<ToolAnnotations>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
||||||
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
||||||
|
|
||||||
const transport = new SSEClientTransport( new URL(`http://127.0.0.1:8000/sse`));
|
const transport = new SSEClientTransport(new URL(`http://127.0.0.1:8000/sse`));
|
||||||
|
|
||||||
const client = new Client(
|
const client = new Client(
|
||||||
{
|
{
|
||||||
|
|
@ -26,3 +26,4 @@ console.log(templates);
|
||||||
const prompts = await client.listPrompts();
|
const prompts = await client.listPrompts();
|
||||||
console.log(prompts);
|
console.log(prompts);
|
||||||
await client.close();
|
await client.close();
|
||||||
|
await transport.close();
|
||||||
Loading…
Reference in a new issue