notion-mcp-utils
Parse Notion MCP responses: extract JSON from text field.
- License 许可
- MIT
- 最近更新
- 2026-10-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- notion-mcp-utils
- author
- Hermes Agent
- license
- MIT
- version
- 0.1.0
- metadata
- { "hermes": { "tags": [ "Notion", "MCP", "Integration", "Productivity" ], "homepage": "https://developers.notion.com" } }
- platforms
- [ "linux", "macos", "windows" ]
- description
- Parse Notion MCP responses: extract JSON from text field.
- prerequisites
- { "env_vars": [ "NOTION_TOKEN" ] }
03 SKILL.md 正文
Notion MCP Utilities
This skill provides tips and tricks for using the Notion MCP server effectively, especially for parsing its responses.
Parsing MCP Responses
The Notion MCP server returns a JSON object with a content array. The actual result is in the text field of the first element, which is a stringified JSON. You must parse this string to get the actual data.
Example: Parsing a search response
# Call the MCP server
RESULT=$(mcp-cli call notion API-post-search '{"query":"tasks"}')
# Extract the inner JSON string (the value of the "text" field)
INNER_JSON=$(echo "$RESULT" | sed -n 's/.*"text": "\(.*\)".*/\1/p' | head -1)
# Unescape the string: convert \\ to \, \" to ", and \n to newline
UNESCAPED=$(echo "$INNER_JSON" | sed 's/\\\\/\\/g' | sed 's/\\"/"/g' | sed 's/\\n/\n/g')
# Now $UNESCAPED is the actual JSON you can parse with jq or similar
echo "$UNESCAPED" | jq .
Example: Extracting titles from a data source query
Assuming you have a data source ID and want to get the titles of items:
DATA_SOURCE_ID="fff21259-8cc5-8112-9f23-ec2d76a3e223"
FILTER='{"property":"Status","select":{"equals":"Done"}}'
RESULT=$(mcp-cli call notion API-query-data-source "{\"data_source_id\":\"$DATA_SOURCE_ID\"}" 2>/dev/null <<< "$FILTER")
INNER_JSON=$(echo "$RESULT" | sed -n 's/.*"text": "\(.*\)".*/\1/p' | head -1)
UNESCAPED=$(echo "$INNER_JSON" | sed 's/\\\\/\\/g' | sed 's/\\"/"/g' | sed 's/\\n/\n/g')
# Extract titles (assuming a title property)
echo "$UNESCAPED" | jq -r '.results[].properties.title.title[0].text.content'
When to Use MCP vs. Raw HTTP
See the notion skill for a detailed comparison. This utility focuses on the MCP-specific Got: parsing.
Troubleshooting
- Empty response from MCP: If you get an empty response, the server might be failing silently. Try calling the Notion API directly with curl using the token from
~/.mcp_servers.json. - Parsing errors: Ensure you are correctly unescaping the string. The
sedcommands above handle common escapes.
Reference
This skill complements the existing notion skill. For general Notion API usage (HTTP/curl, ntn CLI), refer to the notion skill.
04 同仓库更多 Skills
blocked-page-recovery
Use when a fetch fails: 403/429, paywall, WAF, bot wall.
gemini-vision-fallback
Vision fallback: Gemini REST API if vision_analyze blocked.
twitter-cli
Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups. Invoke whenever user requests any Twitter interaction.
prism-scan
Structural analysis through dynamically generated cognitive lenses. Generates the optimal analytical lens for the specific code/artifact, then executes it. Finds conservation laws, structural invariants, and concrete bugs that vanilla analysis misses. Use on any code file, system design, or text artifact.
prism-reflect
Constraint transparency: analyzes an artifact structurally, then analyzes what its own analysis concealed. Produces a conservation law AND a constraint report showing what was maximized, what was sacrificed, and what to investigate next. The only AI skill that knows what it can't see.
prism-full
Full Prism: multi-pass structural analysis with mandatory adversarial self-correction. Designs custom analytical passes, executes them with chaining, then attacks its own findings before synthesizing. Use for maximum depth on important code or artifacts.