MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / handle_get_prompt

Function handle_get_prompt

codewiki/mcp/tools/prompt_server.py:77–103  ·  view source on GitHub ↗

Return a prompt template, optionally with variables filled in.

(
    arguments: Dict[str, Any],
    store: SessionStore,
)

Source from the content-addressed store, hash-verified

75
76
77def handle_get_prompt(
78 arguments: Dict[str, Any],
79 store: SessionStore,
80) -> str:
81 """Return a prompt template, optionally with variables filled in."""
82 prompt_type = arguments["prompt_type"]
83 variables = arguments.get("variables", {})
84
85 if prompt_type not in _PROMPT_CATALOG:
86 available = list(_PROMPT_CATALOG.keys())
87 return json.dumps({
88 "error": f"Unknown prompt_type: {prompt_type}",
89 "available_types": available,
90 })
91
92 catalog_entry = _PROMPT_CATALOG[prompt_type]
93
94 # Resolve the prompt content
95 content = _resolve_prompt(prompt_type, variables)
96
97 result = {
98 "prompt_type": prompt_type,
99 "description": catalog_entry["description"],
100 "usage_hint": catalog_entry["usage_hint"],
101 "content": content,
102 }
103 return json.dumps(result, indent=2, ensure_ascii=False)
104
105
106def _resolve_prompt(prompt_type: str, variables: Dict[str, Any]) -> str:

Callers

nothing calls this directly

Calls 2

_resolve_promptFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected