Skip to main content

define_tool_declaration

Function define_tool_declaration 

Source
pub fn define_tool_declaration<P>(
    name: impl Into<String>,
    description: impl Into<String>,
) -> Tool
where P: JsonSchema,
Expand description

Define a declaration-only Tool with a JSON Schema derived from P.

Equivalent to define_tool but produces a Tool with no attached handler — useful when another connected client services this tool, or when you only need to advertise the schema for capability negotiation.

§Example

use github_copilot_sdk::tool::{define_tool_declaration, JsonSchema};
use serde::Deserialize;

#[derive(Deserialize, JsonSchema)]
struct Params { query: String }

let declared = define_tool_declaration::<Params>(
    "legacy_thing",
    "Handled by another connected client",
);