Skip to main content Startseite Ersteller jeremylongshore tons-of-skills-marketplace onenote-debug-bundle
onenote-debug-bundle Generate comprehensive diagnostic bundles for OneNote Graph API issues with request tracing and token analysis.
Use when debugging OneNote API failures, filing Microsoft support tickets, or analyzing permission issues.
Trigger with "onenote debug", "onenote diagnostic", "onenote support ticket", "graph api troubleshoot onenote".
Zur Installation springen Skills Marktplatz Entdecken und erkunden Sie KI-Skills, die von der Community erstellt wurden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Prompt kopierenPrompt-Details anzeigen Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace --skill onenote-debug-bundleDer Befehl bleibt in einer Zeile. Scrollen Sie horizontal, um ihn vor dem Kopieren vollständig zu prüfen.
Sie bevorzugen eine lokale Kopie? Laden Sie die Dateien herunter, die SkillsMP derzeit vorliegen.
ZIP herunterladen Herunterladen... Mehr aus diesem Repository langchain-deploy-integration Deploy a LangChain 1.0 / LangGraph 1.0 app to Cloud Run, Vercel, or LangServe correctly — with timeouts sized for chain length, cold-start mitigation, SSE anti-buffering headers, and Secret Manager over .env. Use when prepping a first production deploy, debugging a stream that hangs behind a proxy, or diagnosing p99 latency spikes. Trigger with "langchain deploy", "langchain cloud run", "langchain vercel python", "langchain langserve", or "langchain docker".
langchain-langgraph-agents Build a correct LangGraph 1.0 ReAct agent with create_react_agent — typed tools, error propagation, recursion caps, and stop conditions that actually stop. Use when writing a first tool-calling agent, migrating from AgentExecutor or initialize_agent, or diagnosing an agent that loops on vague prompts. Trigger with "langgraph agent", "create_react_agent", "langgraph tool calling", "AgentExecutor migration", or "agent loop cost".
langchain-langgraph-human-in-loop Build LangGraph 1.0 human-in-the-loop approval flows with interrupt_before /
interrupt_after and Command(resume=...) — JSON-serializable state, clean
resume semantics, and UI wiring for approval decisions. Use when adding an
approval gate before an expensive tool call, wiring a Slack/web UI for agent
approvals, or debugging a graph that crashes on interrupt.
Trigger with "langgraph human in loop", "langgraph interrupt_before",
"langgraph approval flow", "Command resume", "langgraph HITL".
name onenote-debug-bundle description Generate comprehensive diagnostic bundles for OneNote Graph API issues with request tracing and token analysis.
Use when debugging OneNote API failures, filing Microsoft support tickets, or analyzing permission issues.
Trigger with "onenote debug", "onenote diagnostic", "onenote support ticket", "graph api troubleshoot onenote".
allowed-tools Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep version 1.6.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","onenote","microsoft"] compatibility Designed for Claude Code
OneNote Debug Bundle
Overview
When OneNote API calls fail, you need the request-id response header (Microsoft support requires it), decoded JWT token claims (to verify granted scopes), the x-ms-ags-diagnostic header (internal Graph routing info), and the full error body — all correlated to a single request. This skill generates structured diagnostic bundles for self-diagnosis and Microsoft support ticket filing.
Prerequisites
Node.js 18+ or Python 3.10+
An existing OneNote integration with Graph API calls
@microsoft/microsoft-graph-client or msgraph-sdk installed
Access token available (for token inspection)
Instructions
TypeScript Diagnostic Middleware
Intercept all Graph API calls and capture diagnostics automatically:
interface DiagnosticEntry {
timestamp : string ; method : string ; url : string ; status : number ;
requestId : string | null ; agsDiagnostic : string | null ;
retryAfter : string | null ; duration_ms : number ; error : any | null ;
}
const diagnosticLog : DiagnosticEntry [] = [];
export function createDiagnosticMiddleware ( ) {
return {
execute : async ( : ) => {
start = . ();
{ url, method } = context. || { : , : };
{
context. ();
h = context. ?. ;
diagnosticLog. ({
: (). (), method, url,
: context. ?. || ,
: h?. ?.( ) || ,
: h?. ?.( ) || ,
: h?. ?.( ) || ,
: . () - start, : ,
});
} ( : ) {
diagnosticLog. ({
: (). (), method, url,
: err?. || ,
: err?. ?.[ ] || ,
: err?. ?.[ ] || ,
: err?. ?.[ ] || ,
: . () - start,
: { : err?. , : err?. , : err?. },
});
err;
}
},
};
}
( ): [] { [...diagnosticLog]; }
( ): { diagnosticLog. = ; }
context
any
const
Date
now
const
request
url
"unknown"
method
"GET"
try
await
next
const
response
headers
push
timestamp
new
Date
toISOString
status
response
status
0
requestId
get
"request-id"
null
agsDiagnostic
get
"x-ms-ags-diagnostic"
null
retryAfter
get
"retry-after"
null
duration_ms
Date
now
error
null
catch
err
any
push
timestamp
new
Date
toISOString
status
statusCode
0
requestId
headers
"request-id"
null
agsDiagnostic
headers
"x-ms-ags-diagnostic"
null
retryAfter
headers
"retry-after"
null
duration_ms
Date
now
error
code
code
message
message
body
body
throw
export
function
getDiagnosticLog
DiagnosticEntry
return
export
function
clearDiagnosticLog
void
length
0
Token Claims Inspection (No External Libraries) Decode a JWT access token to inspect scopes and expiry using only built-in Base64:
export function decodeTokenClaims (accessToken : string ): Record <string , any > {
const parts = accessToken.split ("." );
if (parts.length !== 3 ) throw new Error ("Invalid JWT: expected 3 dot-separated parts" );
const base64 = parts[1 ].replace (/-/g , "+" ).replace (/_/g , "/" );
const padded = base64 + "=" .repeat ((4 - (base64.length % 4 )) % 4 );
return JSON .parse (Buffer .from (padded, "base64" ).toString ("utf-8" ));
}
export function analyzePermissions (claims : Record <string , any >, required : string [] ) {
const granted = claims.scp ? claims.scp .split (" " ) : (claims.roles || []);
const missing = required.filter ((s ) => !granted.includes (s));
const now = Math .floor (Date .now () / 1000 );
const isExpired = claims.exp < now;
const diff = Math .abs (claims.exp - now);
const expiresIn = isExpired ? `Expired ${diff} s ago` : `${Math .floor(diff / 60 )} m remaining` ;
return { granted, missing, isExpired, expiresIn };
}
Python Diagnostic Context Manager
import json, base64, time
from datetime import datetime, timezone
from dataclasses import dataclass, asdict
from typing import Optional
@dataclass
class DiagnosticCapture :
timestamp: str ; method: str ; url: str ; status: int
request_id: Optional [str ]; ags_diagnostic: Optional [str ]
retry_after: Optional [str ]; duration_ms: float
error_code: Optional [str ]; error_message: Optional [str ]
class GraphDiagnostics :
def __init__ (self ):
self .captures: list [DiagnosticCapture] = []
async def capture_request (self, client, method: str , endpoint: str , **kwargs ):
url = f"https://graph.microsoft.com/v1.0{endpoint} "
start = time.monotonic()
try :
response = await client.api(endpoint).get() if method == "GET" \
else await client.api(endpoint).post(kwargs.get("body" ))
self .captures.append(DiagnosticCapture(
datetime.now(timezone.utc).isoformat(), method, url, 200 ,
None , None , None , round ((time.monotonic()-start)*1000 , 2 ), None , None ))
return response
except Exception as e:
headers = getattr (e, "headers" , {}) or {}
self .captures.append(DiagnosticCapture(
datetime.now(timezone.utc).isoformat(), method, url,
int (getattr (e, "status_code" , 0 )),
headers.get("request-id" ), headers.get("x-ms-ags-diagnostic" ),
headers.get("retry-after" ), round ((time.monotonic()-start)*1000 , 2 ),
str (getattr (e, "code" , type (e).__name__)), str (e)))
raise
def export_bundle (self, filepath: str , token: Optional [str ] = None ) -> str :
bundle = {"bundle_version" : "1.0" , "generated" : datetime.now(timezone.utc).isoformat(),
"captures" : [asdict(c) for c in self .captures]}
if token:
parts = token.split("." )
bundle["token_claims" ] = json.loads(base64.urlsafe_b64decode(parts[1 ] + "==" ))
with open (filepath, "w" ) as f:
json.dump(bundle, f, indent=2 )
return filepath
Microsoft Support Ticket Template When filing a support case, include this from the diagnostic bundle:
Subject: OneNote Graph API - [Error Code] on [Endpoint]
1. Request ID: [from request-id response header]
2. Timestamp (UTC): [from diagnostic bundle]
3. Tenant ID: [from token claims tid]
4. App ID: [from token claims azp]
5. Endpoint: GET /me/onenote/notebooks
6. HTTP Status: 403
7. Error Code: ErrorAccessDenied
8. Error Message: Access is denied.
9. x-ms-ags-diagnostic: [full header value]
10. Token scopes granted: Notes.Read User.Read
11. Expected scopes: Notes.ReadWrite
12. SDK version: @microsoft/microsoft-graph-client@3.0.7
Common Diagnostic Patterns "Why is my 403 happening?" — Decode token, compare scopes:
const claims = decodeTokenClaims (accessToken);
const { missing, isExpired, expiresIn } = analyzePermissions (claims, ["Notes.ReadWrite" ]);
if (missing.length > 0 ) console .error (`Missing scopes: ${missing.join(", " )} ` );
if (isExpired) console .error (`Token expired: ${expiresIn} ` );
"Which request failed in a batch?" — Filter diagnostic log:
const failures = getDiagnosticLog ().filter ((e ) => e.status >= 400 );
failures.forEach ((f ) => console .error (`[${f.requestId} ] ${f.method} ${f.url} -> ${f.status} ` ));
Output
src/debug/diagnostic-middleware.ts — automatic Graph API call interception
src/debug/token-inspector.ts — JWT decode and permission analysis (zero dependencies)
debug/diagnostic_capture.py — Python diagnostic context manager with bundle export
Diagnostic bundle JSON file with request-id, token claims, and error details
Microsoft support ticket template with required fields
Error Handling Debug Issue Cause Fix request-id is nullResponse headers not captured Use diagnostic middleware; direct fetch bypasses header capture JWT decode fails Token is opaque (v1) Graph tokens should be v2 JWT; check aud matches https://graph.microsoft.com scp claim emptyApp-only token (no delegated scopes) App-only auth deprecated March 2025; switch to delegated x-ms-ags-diagnostic missingNot all errors include it Optional header; rely on request-id for support tickets Wrong tenant in claims Multi-tenant app resolving wrong Verify AZURE_TENANT_ID; check tid claim
Examples
import { getDiagnosticLog } from "./debug/diagnostic-middleware" ;
import { decodeTokenClaims, analyzePermissions } from "./debug/token-inspector" ;
import { writeFileSync } from "fs" ;
const bundle = {
bundle_version : "1.0" , timestamp : new Date ().toISOString (),
log : getDiagnosticLog (),
token : analyzePermissions (decodeTokenClaims (token), ["Notes.Read" , "Notes.ReadWrite" ]),
};
writeFileSync (`onenote-debug-${Date .now()} .json` , JSON .stringify (bundle, null , 2 ));
node -e "
const t = process.env.GRAPH_TOKEN;
const p = JSON.parse(Buffer.from(t.split('.')[1].replace(/-/g,'+').replace(/_/g,'/'), 'base64'));
console.log('Scopes:', p.scp, '| Expires:', new Date(p.exp*1000).toISOString());
"
Resources
Next Steps
Fix common errors with onenote-common-errors
Tune performance after diagnosing bottlenecks with onenote-performance-tuning
Check rate limit patterns with onenote-rate-limits