Official documentation: https://ai.google.dev/gemini-api/docs/url-context?hl=zh-cnThe URL context tool lets you provide more context to your model in the form of URLs. By adding URLs to the request, the model will access content from those pages (as long as it is not the URL type listed in the restrictions section), thereby informing and improving the quality of the answer.The URL context tool is useful for the following tasks:Extract data: Extract specific information like prices, names, or key findings from multiple URLs. Compare documents: Analyze multiple reports, articles, or PDFs to find differences and track trends. Synthesize and create content: Combine information from multiple source URLs to produce accurate summaries, blog posts, or reports. Analyze code and documentation: Point to a GitHub repository or technical documentation to explain code, generate setup instructions, or answer questions.
Request
Query Params
Header Params
Body Params application/json
Example
{"contents":[{"role":"user","parts":[{"text":"Interpreting this website https://www.youtube.com/watch?v=QCvF8mCPwdQ"}]}],"tools":[{"UrlContext":{}}]}