pub async fn assemble_code_mode_prompt(
connector: &(dyn SqlConnector + '_),
config: &ServerConfig,
) -> Result<String>Expand description
TKIT-10: assemble the code-mode bootstrap prompt body from a connector’s
SqlConnector::schema_text + curated [[database.tables]] descriptions.
Per Phase 83 review R2 (BOTH reviewers HIGH severity), this function calls
ONLY SqlConnector::schema_text — never execute(), which is deferred
to Phase 84. Dialect-aware placeholder GUIDANCE is included even though
translate_placeholders is deferred, because the LLM still benefits from
knowing the eventual binding shape.
§Output structure
# Code Mode — {dialect.name()}
{dialect.placeholder_guidance()}
## Schema
{connector.schema_text()}
## Curated Tables
- `table_a`: description A
- `table_b`: description BThe “Curated Tables” section is omitted entirely when
config.database.tables is empty OR every entry has no description.
Entries with description = None are skipped individually.
§Errors
Returns ToolkitError::CodeMode if connector.schema_text() fails.
The toolkit does not retry; callers should ensure the connector is ready
before assembling.
§Example
use pmcp_server_toolkit::code_mode::assemble_code_mode_prompt;
use pmcp_server_toolkit::config::ServerConfig;
use pmcp_server_toolkit::sql::SqlConnector;
async fn assemble<C: SqlConnector>(connector: &C, config: &ServerConfig) {
let prompt = assemble_code_mode_prompt(connector, config).await.unwrap();
assert!(prompt.contains("# Code Mode"));
}