Thank you @acbmd for this great share.
Got it up and running – after hours of debugging.
The MCP Server tinderbox_mcp_server.py
needed tweeking, though, in line 168
@server.list_tools()
async def handle_list_tools():
"""Return list of available tools"""
print("handle_list_tools called", file=sys.stderr)
return TOOLS_LIST # Return just the list, not wrapped in dict
which had to be replaced – according to Claude – with
@server.list_tools()
async def handle_list_tools():
"""Return list of available tools"""
print("handle_list_tools called", file=sys.stderr)
from mcp.types import Tool
# Convert dict tools to Tool objects
tools = []
for tool_dict in TOOLS_LIST:
tool = Tool(
name=tool_dict["name"],
description=tool_dict["description"],
inputSchema=tool_dict["inputSchema"]
)
tools.append(tool)
return tools
Working fine …
The AppleScript was not working when it came to linking one note to another …
So with Claude’s assistence the entire create_link
function had to be changed like so:
async def create_link(from_note: str, to_note: str,
link_type: Optional[str] = None,
document: Optional[str] = None) -> List[Dict[str, Any]]:
"""Create a link between notes"""
try:
doc_specifier = f'document "{document}"' if document else 'front document'
# Clean note paths - remove leading slash if present
to_note_clean = to_note.lstrip('/')
script = f'''
tell application "Tinderbox 10"
tell {doc_specifier}
set sourceNote to note "{from_note}"
evaluate sourceNote with "linkTo(/{to_note_clean})"
end tell
end tell
'''
result = TinderboxHelper.run_applescript(script)
return [{"type": "text", "text": "Link created successfully"}]
except Exception as e:
return [{"type": "text", "text": f"Error: {str(e)}"}]
That did the trick. Maybe helpful to others.
Any idea @acbmd?
Cheers,
andreas