MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / _tool_schema_map

Method _tool_schema_map

examples/server/server.py:5190–5207  ·  view source on GitHub ↗
(
        tools: Optional[List[ChatTemplateTool]],
    )

Source from the content-addressed store, hash-verified

5188
5189 @staticmethod
5190 def _tool_schema_map(
5191 tools: Optional[List[ChatTemplateTool]],
5192 ) -> Dict[str, Dict[str, Any]]:
5193 if tools is None:
5194 return {}
5195 mapping: Dict[str, Dict[str, Any]] = {}
5196 for tool in tools:
5197 if tool.get("type") != "function":
5198 continue
5199 function = tool.get("function", {})
5200 name = function.get("name")
5201 parameters = function.get("parameters")
5202 if isinstance(name, str) and isinstance(parameters, dict):
5203 mapping[name] = {
5204 "parameters": parameters,
5205 "content_type": function.get("content_type"),
5206 }
5207 return mapping
5208
5209 @classmethod
5210 def _cached_tool_schema_map(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected