fix for variables not being passed
This commit is contained in:
parent
0499798e48
commit
d23fb0cfbb
|
|
@ -203,7 +203,7 @@ The MCP server provides these tools to AI assistants:
|
|||
|------|-------------|
|
||||
| `list_templates` | List available templates |
|
||||
| `get_template` | Get template content |
|
||||
| `create_note_from_template` | Create a note from a template with variable substitution |
|
||||
| `create_note_from_template` | Create a note from a template (built-in placeholders only) |
|
||||
|
||||
### System
|
||||
|
||||
|
|
@ -291,15 +291,18 @@ Get recently modified notes. Useful for context about what you've been working o
|
|||
|
||||
### `create_note_from_template`
|
||||
|
||||
Create a new note from a template with variable substitution.
|
||||
Create a new note from a template. Built-in placeholders are substituted
|
||||
server-side. Need to inject custom content? Call `update_note` after creation.
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `template_name` | string | Yes | Template name (e.g., "meeting-notes") |
|
||||
| `note_path` | string | Yes | Path for the new note |
|
||||
| `variables` | object | No | Variables to substitute (e.g., `{"project": "Alpha"}`) |
|
||||
|
||||
**Built-in placeholders:** `{{date}}`, `{{time}}`, `{{datetime}}`, `{{title}}`, `{{folder}}`
|
||||
**Built-in placeholders:** `{{title}}`, `{{date}}`, `{{time}}`, `{{datetime}}`,
|
||||
`{{timestamp}}`, `{{year}}`, `{{month}}`, `{{day}}`, `{{folder}}`, plus the
|
||||
`strftime` escape hatch — `{{date:FMT}}`, `{{time:FMT}}`, `{{datetime:FMT}}`
|
||||
where `FMT` is a Python `strftime()` format string. See [TEMPLATES.md](TEMPLATES.md).
|
||||
|
||||
**Example prompt:** "Create a new meeting note for Project Alpha using the meeting-notes template"
|
||||
|
||||
|
|
|
|||
|
|
@ -241,15 +241,18 @@ class NoteDiscoveryClient:
|
|||
self,
|
||||
template_name: str,
|
||||
note_path: str,
|
||||
variables: dict | None = None
|
||||
) -> APIResponse:
|
||||
"""
|
||||
Create a note from a template.
|
||||
|
||||
Built-in placeholders ({{title}}, {{date}}, {{datetime}},
|
||||
{{folder}}, {{date:FMT}}, etc.) are substituted server-side
|
||||
by apply_template_placeholders. There is no per-call variable
|
||||
injection; use update_note after creation for custom content.
|
||||
|
||||
Args:
|
||||
template_name: Name of the template
|
||||
note_path: Path for the new note
|
||||
variables: Variables to substitute in the template
|
||||
|
||||
Returns:
|
||||
APIResponse with creation result
|
||||
|
|
@ -259,9 +262,6 @@ class NoteDiscoveryClient:
|
|||
"templateName": template_name,
|
||||
"notePath": note_path,
|
||||
}
|
||||
if variables:
|
||||
data["variables"] = variables
|
||||
|
||||
return self._request("POST", "/api/templates/create-note", data=data)
|
||||
|
||||
# =========================================================================
|
||||
|
|
|
|||
|
|
@ -625,7 +625,6 @@ class MCPServer:
|
|||
"""Create a note from a template."""
|
||||
template_name = args.get("template_name", "")
|
||||
note_path = args.get("note_path", "")
|
||||
variables = args.get("variables", {})
|
||||
|
||||
if not template_name:
|
||||
return "Error: template_name is required"
|
||||
|
|
@ -634,7 +633,7 @@ class MCPServer:
|
|||
if not is_valid:
|
||||
return f"Error: note_path - {error}"
|
||||
|
||||
response = self.client.create_note_from_template(template_name, note_path, variables)
|
||||
response = self.client.create_note_from_template(template_name, note_path)
|
||||
|
||||
if not response.success:
|
||||
return f"Failed to create note from template: {response.error}"
|
||||
|
|
|
|||
|
|
@ -238,7 +238,12 @@ TOOLS: list[dict[str, Any]] = [
|
|||
},
|
||||
{
|
||||
"name": "create_note_from_template",
|
||||
"description": "Create a new note from a template with variable substitution. Variables in the template like {{variable_name}} will be replaced.",
|
||||
"description": (
|
||||
"Create a new note from a template. Built-in placeholders like "
|
||||
"{{title}}, {{date}}, {{datetime}}, {{folder}}, {{date:FMT}} are "
|
||||
"substituted automatically (FMT is a Python strftime string). "
|
||||
"Use update_note afterwards if you need to inject custom content."
|
||||
),
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
@ -249,10 +254,6 @@ TOOLS: list[dict[str, Any]] = [
|
|||
"note_path": {
|
||||
"type": "string",
|
||||
"description": "Path for the new note (e.g., 'meetings/2024-03-13.md')"
|
||||
},
|
||||
"variables": {
|
||||
"type": "object",
|
||||
"description": "Variables to substitute in the template (e.g., {\"project\": \"Alpha\", \"date\": \"2024-03-13\"})"
|
||||
}
|
||||
},
|
||||
"required": ["template_name", "note_path"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue