{"at":"2026-11-23T06:09:22.468Z","dir":"sent","era":"server_discover","message":{"id":1,"jsonrpc":"2.0","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"didrun-lab","version":"0.1.0"},"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}}
{"at":"2026-11-23T06:09:23.362Z","dir":"received","era":"server_discover","message":{"error":{"code":-32602,"data":"","message":"Invalid request parameters"},"id":1,"jsonrpc":"2.0"}}
{"at":"2026-11-23T06:09:23.513Z","dir":"sent","era":"initialize","message":{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"didrun-lab","version":"0.1.0"},"protocolVersion":"2025-11-25"}}}
{"at":"2026-11-23T06:09:24.435Z","dir":"received","era":"initialize","message":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"experimental":{},"prompts":{"listChanged":false},"resources":{"listChanged":false,"subscribe":false},"tools":{"listChanged":false}},"instructions":"Open data from the Dominican Republic's official portal, datos.gob.do: 1,061 datasets from 266 government institutions.\n\nThree habits this catalog demands:\n\n1. Roughly half of the catalog's files cannot be downloaded — the publishing institution's own site refuses programmatic access. Use check_resources before recommending a source. If a file cannot be read, say so; never answer with a different file, from a different institution or period, as if it were the one requested.\n\n2. Distinguish what the catalog claims from what you read. Catalog replies carry source: catalog_metadata, analytics replies source: file_contents. A dataset's description is not evidence about its contents.\n\n3. Report what the numbers cost. Government spreadsheets store numbers as text and leave headers inside the data, so results carry numeric_coercion naming what was excluded, source_sha256 for the bytes read, and computation with the SQL that ran. Pass those on: they are what make a figure checkable.\n\nStart with search_datasets, then get_resource_schema before analysing.","protocolVersion":"2025-11-25","serverInfo":{"name":"datosgobdo-mcp","version":"0.14.0","websiteUrl":"https://github.com/alcastaro/datos.gob.do-MCP-server"}}}}
{"at":"2026-11-23T06:09:24.435Z","dir":"sent","era":"initialize","message":{"jsonrpc":"2.0","method":"notifications/initialized"}}
{"at":"2026-11-23T06:09:24.435Z","dir":"sent","era":"initialize","message":{"id":2,"jsonrpc":"2.0","method":"tools/list","params":{}}}
{"at":"2026-11-23T06:09:24.437Z","dir":"received","era":"initialize","message":{"id":2,"jsonrpc":"2.0","result":{"tools":[{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Search datasets"},"description":"Search datasets on datos.gob.do (Dominican Republic open data).\n\nFilter by keyword, institution, tag or thematic group. Returns summary\nmetadata: title, publishing institution, available formats, URL.\n","inputSchema":{"properties":{"group":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Thematic group, e.g. 'economia', 'salud'.","title":"Group"},"limit":{"default":10,"description":"Results (1-50)","maximum":50,"minimum":1,"title":"Limit","type":"integer"},"offset":{"default":0,"description":"Offset for paging","minimum":0,"title":"Offset","type":"integer"},"organization":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Institution slug, e.g. 'ministerio-de-salud-publica'. Slugs are the full registered name, so acronyms rarely work on their own — use autocomplete(kind='organization') when unsure.","title":"Organization"},"query":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Free-text search term, e.g. 'presupuesto', 'salud publica', 'educacion'. Omit to list everything.","title":"Query"},"tag":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Topic tag, e.g. 'finanzas', 'poblacion'.","title":"Tag"}},"title":"search_datasetsArguments","type":"object"},"name":"search_datasets","outputSchema":{"additionalProperties":true,"title":"search_datasetsDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Get dataset metadata"},"description":"Full metadata for one dataset, including every downloadable resource.\n\nReturns title, description, institution, licence, and the complete resource\nlist (CSV/XLSX/PDF/… files) with direct download URLs.\n","inputSchema":{"properties":{"id":{"description":"Dataset UUID or slug, e.g. 'nomina-general' or '40bc3980-625b-4d7b-9ccc-304878126f8f'.","title":"Id","type":"string"}},"required":["id"],"title":"get_datasetArguments","type":"object"},"name":"get_dataset","outputSchema":{"additionalProperties":true,"title":"get_datasetDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"List recent datasets"},"description":"Most recently modified datasets on datos.gob.do.\n\nFor monitoring portal updates. Returns hydrated metadata, not raw\nactivity records.\n","inputSchema":{"properties":{"limit":{"default":10,"description":"How many (1-30)","maximum":30,"minimum":1,"title":"Limit","type":"integer"}},"title":"list_recent_datasetsArguments","type":"object"},"name":"list_recent_datasets","outputSchema":{"additionalProperties":true,"title":"list_recent_datasetsDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Get resource metadata"},"description":"Metadata for one resource (file): download URL, format, size.","inputSchema":{"properties":{"id":{"description":"Resource UUID.","title":"Id","type":"string"}},"required":["id"],"title":"get_resourceArguments","type":"object"},"name":"get_resource","outputSchema":{"additionalProperties":true,"title":"get_resourceDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Search resources"},"description":"Search individual files by name. Returns download URLs, with the dataset and institution behind each one.","inputSchema":{"properties":{"limit":{"default":10,"description":"Results (1-50)","maximum":50,"minimum":1,"title":"Limit","type":"integer"},"query":{"description":"Resource name, or part of it.","title":"Query","type":"string"}},"required":["query"],"title":"search_resourcesArguments","type":"object"},"name":"search_resources","outputSchema":{"additionalProperties":true,"title":"search_resourcesDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Preview resource data"},"description":"Download a resource and return N rows with their column headers.\n\nThe datos.gob.do portal has no DataStore (no SQL), so this tool downloads\nthe file and parses it client-side. 5 MB cap to avoid huge files. Useful\nfor inspecting the structure of the data before deciding how to query it.\nFor analytical queries on big files, use get_resource_schema +\nsummarize_resource (v0.2) or aggregate_resource (v0.3+).\n","inputSchema":{"properties":{"format":{"description":"Format declared in CKAN ('format' field). Accepts: csv, tsv, xlsx, xls, json.","title":"Format","type":"string"},"rows":{"default":20,"description":"Rows to return (1-200). Default 20.","maximum":200,"minimum":1,"title":"Rows","type":"integer"},"sample":{"default":"head","description":"Which slice to return: 'head' (first N), 'tail' (last N of downloaded portion), or 'random' (uniform sample). For large files, prefer summarize_resource or aggregate_resource.","enum":["head","tail","random"],"title":"Sample","type":"string"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field). Supports CSV, TSV, XLSX, JSON.","title":"Url","type":"string"}},"required":["url","format"],"title":"download_resource_previewArguments","type":"object"},"name":"download_resource_preview","outputSchema":{"additionalProperties":true,"properties":{"bytes_downloaded":{"anyOf":[{"type":"integer"},{"type":"null"}]},"columns":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}]},"download_truncated":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"rows":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}]},"rows_returned":{"anyOf":[{"type":"integer"},{"type":"null"}]},"sample_mode":{"anyOf":[{"type":"string"},{"type":"null"}]},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"total_rows_in_download":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Check whether resources can be downloaded"},"description":"Ask whether each file can actually be downloaded, without downloading it.\n\nThe catalog says a resource exists; it does not say the file is still\nthere. Call this before recommending a source — recommending a dataset\nwhose files all refuse sends the user to a dead end, and nothing else here\ntells you in advance. Returns a class, not a yes/no: ok, challenge (a\nbrowser passes, no client can), waf_rule, not_found, server_error,\nhtml_page, head_not_supported, network.\n","inputSchema":{"properties":{"urls":{"description":"Direct file URLs (a resource's 'url'). Max 25.","items":{"type":"string"},"title":"Urls","type":"array"}},"required":["urls"],"title":"check_resourcesArguments","type":"object"},"name":"check_resources","outputSchema":{"$defs":{"ResourceReachability":{"additionalProperties":true,"properties":{"reachability":{"type":"string"},"url":{"type":"string"}},"required":["url","reachability"],"type":"object"}},"additionalProperties":true,"description":"What the catalog cannot tell you: whether the file is actually there.","properties":{"checked":{"anyOf":[{"type":"integer"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"reachable":{"anyOf":[{"type":"integer"},{"type":"null"}]},"resources":{"default":[],"items":{"$ref":"#/$defs/ResourceReachability"},"type":"array"},"source":{"default":"live_check","type":"string"}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Get resource schema"},"description":"Return column names, inferred types, and sample values for a resource.\n\nCheap reconnaissance step. Downloads file (up to 100 MB), opens it in\nDuckDB, and runs DESCRIBE + per-column DISTINCT sampling. Does NOT return\nraw rows. Use this before summarize_resource or aggregate_resource so the\nmodel knows column names and types.\n","inputSchema":{"properties":{"format":{"description":"Format declared in CKAN. Accepts: csv, tsv, xlsx, json.","title":"Format","type":"string"},"sample_rows":{"default":6,"description":"Distinct sample values to show per column (1-1000). The default of 6 is enough to recognise what a column holds; raise it only when you need to enumerate a category's values, and expect a much larger reply.","maximum":1000,"minimum":1,"title":"Sample Rows","type":"integer"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field).","title":"Url","type":"string"}},"required":["url","format"],"title":"get_resource_schemaArguments","type":"object"},"name":"get_resource_schema","outputSchema":{"$defs":{"SchemaColumn":{"additionalProperties":true,"properties":{"name":{"type":"string"},"nullable":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"sample_values":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}]},"type":{"type":"string"}},"required":["name","type"],"type":"object"}},"additionalProperties":true,"properties":{"cache":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}]},"column_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"columns":{"default":[],"items":{"$ref":"#/$defs/SchemaColumn"},"type":"array"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"row_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"source":{"default":"file_contents","type":"string"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Summarize resource"},"description":"Auto-generated profile: row count, types, nulls, distinct, min/max/mean, top values.\n\nDownloads file (up to 100 MB), runs DuckDB COUNT/DISTINCT/AGG queries per\ncolumn. Returns one compact dict per column with stats. The model uses this\nto decide which filters and aggregations to apply next, without any raw\nrows in its context. For columns with many distinct values (e.g. names),\n'top_values' is omitted; only counts are returned.\n","inputSchema":{"properties":{"format":{"description":"Format declared in CKAN. Accepts: csv, tsv, xlsx, json.","title":"Format","type":"string"},"max_categorical_top_n":{"default":10,"description":"Top-N most-frequent values per categorical column (1-50).","maximum":50,"minimum":1,"title":"Max Categorical Top N","type":"integer"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field).","title":"Url","type":"string"}},"required":["url","format"],"title":"summarize_resourceArguments","type":"object"},"name":"summarize_resource","outputSchema":{"$defs":{"SummaryColumn":{"additionalProperties":true,"properties":{"distinct_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"max":{"anyOf":[{},{"type":"null"}]},"mean":{"anyOf":[{"type":"number"},{"type":"null"}]},"median":{"anyOf":[{"type":"number"},{"type":"null"}]},"min":{"anyOf":[{},{"type":"null"}]},"name":{"type":"string"},"non_null_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"null_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"top_values":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}]},"type":{"type":"string"}},"required":["name","type"],"type":"object"}},"additionalProperties":true,"properties":{"cache":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}]},"column_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"columns":{"default":[],"items":{"$ref":"#/$defs/SummaryColumn"},"type":"array"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"row_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"source":{"default":"file_contents","type":"string"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Filter resource rows"},"description":"Run a typed WHERE/SELECT/ORDER BY/LIMIT against a cached resource.\n\nFirst call downloads the file (up to 100 MB) and caches it as Parquet at\n~/.cache/datosgobdo-mcp/. Subsequent calls hit cache (<1s). Returns\nrequested columns + matching rows (capped at limit) plus the total count\nof matching rows. Use this when you need actual records, not aggregates.\n","inputSchema":{"properties":{"columns":{"anyOf":[{"items":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"}]},"type":"array"},{"type":"null"}],"default":null,"description":"Columns to SELECT. None = all columns.","title":"Columns"},"filters":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Optional list of filter conditions, AND-combined. Each item is {col, op, val}. Valid ops: =, !=, <, <=, >, >=, in, not_in, contains, starts_with, ends_with, is_null, is_not_null. Example: [{\"col\":\"Año\",\"op\":\"=\",\"val\":2026},{\"col\":\"Mes\",\"op\":\"=\",\"val\":\"Abril\"}].","title":"Filters"},"format":{"description":"Format declared in CKAN. Accepts: csv, tsv, xlsx, json.","title":"Format","type":"string"},"limit":{"default":100,"description":"Max rows to return (1-1000).","maximum":1000,"minimum":1,"title":"Limit","type":"integer"},"offset":{"default":0,"description":"Rows to skip (for paginating).","minimum":0,"title":"Offset","type":"integer"},"order_by":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"List of {col, dir} where dir is \"asc\" or \"desc\". Example: [{\"col\":\"Sueldo Bruto\",\"dir\":\"desc\"}].","title":"Order By"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field).","title":"Url","type":"string"}},"required":["url","format"],"title":"filter_resourceArguments","type":"object"},"name":"filter_resource","outputSchema":{"additionalProperties":true,"properties":{"cache":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}]},"columns":{"default":[],"items":{"type":"string"},"type":"array"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}]},"matching_rows_total":{"anyOf":[{"type":"integer"},{"type":"null"}]},"offset":{"anyOf":[{"type":"integer"},{"type":"null"}]},"rows":{"default":[],"items":{"items":{},"type":"array"},"type":"array"},"rows_returned":{"anyOf":[{"type":"integer"},{"type":"null"}]},"source":{"default":"file_contents","type":"string"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Aggregate resource"},"description":"Run GROUP BY + aggregations against a cached resource without writing SQL.\n\nTyped wrapper that builds safe DuckDB queries from JSON. Example usage:\n\"How many employees by status in April 2026?\" →\n    aggregations=[{col: null, fn: count, alias: empleados}],\n    group_by=[\"Estatus\"],\n    filters=[{col:\"Año\",op:\"=\",val:2026},{col:\"Mes\",op:\"=\",val:\"Abril\"}],\n    order_by=[{col:\"empleados\",dir:\"desc\"}].\n\nFirst call downloads + caches the file. Subsequent calls reuse the cache.\nReturns one row per group with the aggregation values.\n","inputSchema":{"properties":{"aggregations":{"description":"List of {col, fn, alias}. Valid fns: count, count_distinct, sum, avg, mean, median, min, max, stddev, variance. col=null or col='*' means COUNT(*). Example: [{\"col\":null,\"fn\":\"count\",\"alias\":\"empleados\"},{\"col\":\"Sueldo Bruto\",\"fn\":\"sum\",\"alias\":\"masa_salarial\"}].","items":{"additionalProperties":true,"type":"object"},"title":"Aggregations","type":"array"},"filters":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Same syntax as filter_resource.filters. Applied before grouping.","title":"Filters"},"format":{"description":"Format declared in CKAN. Accepts: csv, tsv, xlsx, json.","title":"Format","type":"string"},"group_by":{"anyOf":[{"items":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"}]},"type":"array"},{"type":"null"}],"default":null,"description":"Columns to GROUP BY. Example: [\"Estatus\",\"Mes\"].","title":"Group By"},"having":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Post-aggregation filter on aggregation aliases. Example: [{\"col\":\"empleados\",\"op\":\">\",\"val\":10}].","title":"Having"},"limit":{"default":100,"description":"Max groups to return (1-1000).","maximum":1000,"minimum":1,"title":"Limit","type":"integer"},"order_by":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Same syntax as filter_resource.order_by. Refs aggregation aliases or group cols.","title":"Order By"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field).","title":"Url","type":"string"}},"required":["url","format","aggregations"],"title":"aggregate_resourceArguments","type":"object"},"name":"aggregate_resource","outputSchema":{"additionalProperties":true,"properties":{"cache":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}]},"columns":{"default":[],"items":{"type":"string"},"type":"array"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"anyOf":[{"type":"string"},{"type":"null"}]},"groups_returned":{"anyOf":[{"type":"integer"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}]},"rows":{"default":[],"items":{"items":{},"type":"array"},"type":"array"},"source":{"default":"file_contents","type":"string"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Quantile distribution of numeric columns"},"description":"Percentile distribution (p25/p50/p75/p90/p95/p99) of numeric columns.\n\nFills the gap left by aggregate_resource, which only exposes median.\nFirst call downloads + caches the file. Subsequent calls reuse the cache.\nUseful for salary analysis, budget distributions, and statistical profiling.\n","inputSchema":{"properties":{"columns":{"anyOf":[{"items":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"}]},"type":"array"},{"type":"null"}],"default":null,"description":"Numeric columns to analyze. None = all numeric columns.","title":"Columns"},"filters":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Same filter syntax as filter_resource. Applied before computing.","title":"Filters"},"format":{"description":"Format declared in CKAN. Accepts: csv, tsv, xlsx, json.","title":"Format","type":"string"},"percentiles":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"default":null,"description":"Percentiles to compute (0–1 exclusive). Default: [0.25, 0.5, 0.75, 0.90, 0.95, 0.99].","title":"Percentiles"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field).","title":"Url","type":"string"}},"required":["url","format"],"title":"quantiles_resourceArguments","type":"object"},"name":"quantiles_resource","outputSchema":{"$defs":{"QuantileColumn":{"additionalProperties":true,"properties":{"max":{"anyOf":[{},{"type":"null"}]},"mean":{"anyOf":[{"type":"number"},{"type":"null"}]},"min":{"anyOf":[{},{"type":"null"}]},"name":{"type":"string"},"non_null_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"null_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"type":{"type":"string"}},"required":["name","type"],"type":"object"}},"additionalProperties":true,"properties":{"cache":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}]},"columns":{"default":[],"items":{"$ref":"#/$defs/QuantileColumn"},"type":"array"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"percentiles":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}]},"row_count":{"anyOf":[{"type":"integer"},{"type":"null"}]},"source":{"default":"file_contents","type":"string"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Find duplicate rows"},"description":"Find rows that appear more than once on the given columns (or all columns).\n\nReturns duplicate groups sorted by frequency descending. Useful for detecting\ndata-quality issues in payroll, census, and registry datasets.\nFirst call downloads + caches. Subsequent calls reuse the cache.\n","inputSchema":{"properties":{"columns":{"anyOf":[{"items":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"}]},"type":"array"},{"type":"null"}],"default":null,"description":"Columns to check for duplication. None = all columns. Example: ['Nombre', 'Cedula'] checks for rows with same name and ID.","title":"Columns"},"filters":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Same filter syntax as filter_resource. Applied before duplicate check.","title":"Filters"},"format":{"description":"Format declared in CKAN. Accepts: csv, tsv, xlsx, json.","title":"Format","type":"string"},"limit":{"default":50,"description":"Max duplicate groups to return (1–500).","maximum":500,"minimum":1,"title":"Limit","type":"integer"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field).","title":"Url","type":"string"}},"required":["url","format"],"title":"find_duplicates_resourceArguments","type":"object"},"name":"find_duplicates_resource","outputSchema":{"additionalProperties":true,"properties":{"cache":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}]},"columns":{"default":[],"items":{"type":"string"},"type":"array"},"columns_checked":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}]},"duplicate_groups_found":{"anyOf":[{"type":"integer"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"anyOf":[{"type":"string"},{"type":"null"}]},"groups_returned":{"anyOf":[{"type":"integer"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"rows":{"default":[],"items":{"items":{},"type":"array"},"type":"array"},"source":{"default":"file_contents","type":"string"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"total_duplicate_rows":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Detect outliers in a numeric column"},"description":"Find rows where a numeric column falls outside the IQR fence.\n\nUses the standard IQR method: outliers are values below Q1 - 1.5*IQR or\nabove Q3 + 1.5*IQR. Returns rows sorted by distance from the median.\nUseful for detecting data-entry errors in salary, budget, or census data.\nFirst call downloads + caches. Subsequent calls reuse the cache.\n","inputSchema":{"properties":{"column":{"description":"Numeric column to check. One column per call.","title":"Column","type":"string"},"filters":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Same filter syntax as filter_resource. Applied before outlier detection.","title":"Filters"},"format":{"description":"Format declared in CKAN. Accepts: csv, tsv, xlsx, json.","title":"Format","type":"string"},"limit":{"default":100,"description":"Max outlier rows to return (1–500).","maximum":500,"minimum":1,"title":"Limit","type":"integer"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field).","title":"Url","type":"string"}},"required":["url","format","column"],"title":"detect_outliers_resourceArguments","type":"object"},"name":"detect_outliers_resource","outputSchema":{"additionalProperties":true,"properties":{"cache":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}]},"column":{"anyOf":[{"type":"string"},{"type":"null"}]},"columns":{"default":[],"items":{"type":"string"},"type":"array"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"iqr":{"anyOf":[{"type":"number"},{"type":"null"}]},"lower_fence":{"anyOf":[{"type":"number"},{"type":"null"}]},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"outlier_count_estimate":{"anyOf":[{"type":"integer"},{"type":"null"}]},"q1":{"anyOf":[{"type":"number"},{"type":"null"}]},"q3":{"anyOf":[{"type":"number"},{"type":"null"}]},"rows":{"default":[],"items":{"items":{},"type":"array"},"type":"array"},"rows_returned":{"anyOf":[{"type":"integer"},{"type":"null"}]},"source":{"default":"file_contents","type":"string"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"upper_fence":{"anyOf":[{"type":"number"},{"type":"null"}]}},"type":"object"}},{"annotations":{"destructiveHint":false,"openWorldHint":true,"readOnlyHint":false,"title":"Save query result to CSV"},"description":"Write a query or filter result to a local CSV file.\n\nExport endpoint for analysis workflows — run your filter or SQL, then save\nthe result to open in Excel or another tool. Returns the file path and row count.\nFirst call downloads + caches the source file. Subsequent calls reuse the cache.\n","inputSchema":{"properties":{"columns":{"anyOf":[{"items":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"}]},"type":"array"},{"type":"null"}],"default":null,"description":"Columns to include. None = all. Ignored if sql is provided.","title":"Columns"},"dest":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Absolute path for the output file (.csv or .tsv). If None, saves to ~/Downloads/datosgobdo-exports/<slug>-<timestamp>.csv. Must not contain '..'. Cannot write to system paths (/etc, /usr, /bin, ...).","title":"Dest"},"filters":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Same filter syntax as filter_resource. Used if sql is None.","title":"Filters"},"format":{"description":"Format declared in CKAN. Accepts: csv, tsv, xlsx, json.","title":"Format","type":"string"},"limit":{"default":10000,"description":"Max rows to write (1–100000). Default 10000.","maximum":100000,"minimum":1,"title":"Limit","type":"integer"},"overwrite":{"default":false,"description":"Overwrite dest if it already exists. Default False.","title":"Overwrite","type":"boolean"},"sql":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Read-only SQL query against table 'data' (same rules as query_resource). If provided, takes precedence over filters/columns.","title":"Sql"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field).","title":"Url","type":"string"}},"required":["url","format"],"title":"save_query_to_csvArguments","type":"object"},"name":"save_query_to_csv","outputSchema":{"additionalProperties":true,"properties":{"bytes_written":{"anyOf":[{"type":"integer"},{"type":"null"}]},"cache":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}]},"columns":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"path":{"anyOf":[{"type":"string"},{"type":"null"}]},"rows_written":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Query resource (read-only SQL)"},"description":"Run an ad-hoc read-only SQL query against a cached resource via DuckDB.\n\nPower-user escape hatch when filter_resource / aggregate_resource don't\ncover the case. The cached resource is exposed as the in-memory table\n'data'. SQL is DuckDB dialect — see https://duckdb.org/docs/sql/introduction.\nSupports CSV, TSV, XLSX, XLS, JSON, and ODS (auto-converted to CSV).\n\nSafety:\n  - Only SELECT/WITH statements (CTEs allowed); multi-statement blocked.\n  - DDL/DML keywords (INSERT/UPDATE/DELETE/DROP/CREATE/ALTER/COPY/EXPORT/\n    IMPORT/TRUNCATE/GRANT/REVOKE/PRAGMA/SET/LOAD/INSTALL/ATTACH/DETACH/\n    VACUUM/ANALYZE) rejected outright.\n  - Sandboxed: the resource is materialized in memory and external access\n    is disabled, so table functions (read_text/read_csv/glob/...) cannot\n    read local files or reach the network.\n  - Row cap always applied via outer wrapper.\n","inputSchema":{"properties":{"format":{"description":"Format declared in CKAN. Accepts: csv, tsv, xlsx, xls, json, ods.","title":"Format","type":"string"},"limit":{"default":200,"description":"Hard cap on returned rows (1-1000).","maximum":1000,"minimum":1,"title":"Limit","type":"integer"},"sql":{"description":"Read-only SQL query against table 'data'. Only SELECT/WITH allowed; DDL/DML rejected. The query is wrapped in 'SELECT * FROM (<your sql>) LIMIT <limit>' so a row cap is always enforced. Example: \"SELECT Estatus, COUNT(*) c FROM data WHERE Año=2026 AND Mes='Abril' GROUP BY Estatus ORDER BY c DESC\"","title":"Sql","type":"string"},"url":{"description":"Direct URL to the file (CKAN resource 'url' field).","title":"Url","type":"string"}},"required":["url","format","sql"],"title":"query_resourceArguments","type":"object"},"name":"query_resource","outputSchema":{"additionalProperties":true,"properties":{"cache":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}]},"columns":{"default":[],"items":{"type":"string"},"type":"array"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"rows":{"default":[],"items":{"items":{},"type":"array"},"type":"array"},"rows_returned":{"anyOf":[{"type":"integer"},{"type":"null"}]},"source":{"default":"file_contents","type":"string"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"sql_executed":{"anyOf":[{"type":"string"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":false,"readOnlyHint":true,"title":"Get cache stats"},"description":"Return cache stats (entries, bytes) plus server identity: version, security mode.","inputSchema":{"properties":{},"title":"get_cache_statsArguments","type":"object"},"name":"get_cache_stats","outputSchema":{"additionalProperties":true,"properties":{"cache_dir":{"anyOf":[{"type":"string"},{"type":"null"}]},"entries":{"anyOf":[{"type":"integer"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"max_bytes":{"anyOf":[{"type":"integer"},{"type":"null"}]},"orphan_entries":{"anyOf":[{"type":"integer"},{"type":"null"}]},"total_bytes":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"type":"object"}},{"annotations":{"destructiveHint":true,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Clear analytics cache"},"description":"Remove all cached Parquet files. Returns the count removed.","inputSchema":{"properties":{},"title":"clear_cacheArguments","type":"object"},"name":"clear_cache","outputSchema":{"additionalProperties":true,"properties":{"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"hint":{"anyOf":[{"type":"string"},{"type":"null"}]},"removed_entries":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"List organizations"},"description":"List the government institutions publishing on datos.gob.do.\n\nMinistries, autonomous agencies, municipalities and so on, with a dataset\ncount each. Returns `{organizations, count, limit_reached}`: 266 exist and\n`limit` caps at 200, so a full page is a page, not the set.\n","inputSchema":{"properties":{"limit":{"default":50,"description":"Maximum (1-200)","maximum":200,"minimum":1,"title":"Limit","type":"integer"}},"title":"list_organizationsArguments","type":"object"},"name":"list_organizations","outputSchema":{"additionalProperties":true,"title":"list_organizationsDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Get organization"},"description":"Details for one institution: description, dataset count, URL.","inputSchema":{"properties":{"id":{"description":"Institution UUID or slug, e.g. 'ministerio-de-hacienda'. Slugs are the full registered name, so an acronym alone usually fails: INDOTEL is 'instituto-dominicano-de-las-telecomunicaciones-indotel'.","title":"Id","type":"string"}},"required":["id"],"title":"get_organizationArguments","type":"object"},"name":"get_organization","outputSchema":{"additionalProperties":true,"title":"get_organizationDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"List groups"},"description":"Thematic categories (economy, health, public administration, …) → `{groups, count}`.","inputSchema":{"properties":{},"title":"list_groupsArguments","type":"object"},"name":"list_groups","outputSchema":{"additionalProperties":true,"title":"list_groupsDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"List tags"},"description":"Tags, optionally filtered by prefix → `{tags, count, limit_reached}`.\n\n874 exist, so a listing without `query` is a sample.\n","inputSchema":{"properties":{"limit":{"default":20,"description":"Maximum (1-100)","maximum":100,"minimum":1,"title":"Limit","type":"integer"},"query":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Prefix to filter tags by.","title":"Query"}},"title":"list_tagsArguments","type":"object"},"name":"list_tags","outputSchema":{"additionalProperties":true,"title":"list_tagsDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Autocomplete entities"},"description":"Autocomplete dataset / organization / group / tag names.\n\nResolves a slug when the user gives only part of a name. Slugs here are the\nfull registered name, so acronyms rarely match on their own:\nkind='organization', query='indotel' →\n'instituto-dominicano-de-las-telecomunicaciones-indotel'.\n\nReturns `{suggestions, count, kind, query}`; the echo keeps a zero-result\nreply interpretable.\n","inputSchema":{"properties":{"kind":{"description":"Entity kind to autocomplete.","enum":["dataset","organization","group","tag"],"title":"Kind","type":"string"},"limit":{"default":10,"description":"Suggestions (1-30)","maximum":30,"minimum":1,"title":"Limit","type":"integer"},"query":{"description":"Partial text to complete.","title":"Query","type":"string"}},"required":["kind","query"],"title":"autocompleteArguments","type":"object"},"name":"autocomplete","outputSchema":{"additionalProperties":true,"title":"autocompleteDictOutput","type":"object"}},{"annotations":{"openWorldHint":true,"readOnlyHint":true,"title":"Get site stats"},"description":"Portal-wide totals for datos.gob.do: datasets, institutions, groups, tags.","inputSchema":{"properties":{},"title":"get_site_statsArguments","type":"object"},"name":"get_site_stats","outputSchema":{"additionalProperties":true,"title":"get_site_statsDictOutput","type":"object"}}]}}}
