huskies: merge 855
This commit is contained in:
@@ -1,24 +1,36 @@
|
||||
//! `tools/list` MCP method — returns the static schema for every tool the server exposes.
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::JsonRpcResponse;
|
||||
use serde_json::Value;
|
||||
|
||||
mod agent_tools;
|
||||
mod story_tools;
|
||||
mod system_tools;
|
||||
|
||||
pub(super) fn handle_tools_list(id: Option<Value>) -> JsonRpcResponse {
|
||||
/// Return the full list of MCP tool definitions (name, description, inputSchema).
|
||||
///
|
||||
/// Used by API-based runtimes (Gemini, OpenAI) that need tool schemas
|
||||
/// without going through the network.
|
||||
pub fn list_tools() -> Vec<Value> {
|
||||
let mut tools = Vec::new();
|
||||
tools.extend(story_tools::story_tools());
|
||||
tools.extend(agent_tools::agent_tools());
|
||||
tools.extend(system_tools::system_tools());
|
||||
JsonRpcResponse::success(id, json!({ "tools": tools }))
|
||||
tools
|
||||
}
|
||||
|
||||
/// Wrap `list_tools()` in a JSON-RPC response (test-only helper).
|
||||
#[cfg(test)]
|
||||
pub(crate) fn handle_tools_list(
|
||||
id: Option<Value>,
|
||||
) -> crate::http::gateway::jsonrpc::JsonRpcResponse {
|
||||
use serde_json::json;
|
||||
crate::http::gateway::jsonrpc::JsonRpcResponse::success(id, json!({ "tools": list_tools() }))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use serde_json::json;
|
||||
|
||||
#[test]
|
||||
fn tools_list_returns_all_tools() {
|
||||
|
||||
Reference in New Issue
Block a user