github_mcp/tools/search_tool.rs
1// GitHub v3 REST API MCP server — generated by mcpify. Do not hand-edit.
2
3use rusqlite::Connection;
4
5use crate::data::store::search_endpoints;
6use crate::services::embedding_service::embed;
7
8/// Semantic similarity lookup matching a natural-language query against
9/// candidate API operations (PRD §1.5) — so an LLM never needs the full
10/// OpenAPI spec in context to find the right operation.
11pub fn search_operations(
12 conn: &Connection,
13 query: &str,
14 limit: usize,
15) -> anyhow::Result<serde_json::Value> {
16 let query_embedding = embed(query)?;
17 let results = search_endpoints(conn, &query_embedding, limit)?;
18 Ok(serde_json::to_value(results)?)
19}